Yen Ngo
2010-Jun-30 10:57 UTC
[R] All possible permutations of letter A with other letters
Dear list, I have a vector of letter strings as follow:> LETTERS[c(1:7,9,15,18:25)][1] "A" "B" "C" "D" "E" "F" "G" "I" "O" "R" "S" "T" "U" "V" "W" "X" "Y" I need to find sequences of length 11, which are made from all possible permutations with repetition (not the unique ones) of the letter string A with the other strings, for example AAAAAAAAAAB, AAAAAAAAAABC, AAAAAAAAACB, AABAAAAAAAB. A can be repeated 1-11 times in the sequence. Is there a way to do this in R? Any help would be much appreciated. Best regards, Yen [[alternative HTML version deleted]]
Barry Rowlingson
2010-Jun-30 15:48 UTC
[R] All possible permutations of letter A with other letters
On Wed, Jun 30, 2010 at 11:57 AM, Yen Ngo <yen.ngo78 at yahoo.se> wrote:> Dear list, > > I have a vector of letter strings as follow: > > >> LETTERS[c(1:7,9,15,18:25)] > ?[1] "A" "B" "C" "D" "E" "F" "G" "I" "O" "R" "S" "T" "U" "V" "W" "X" "Y" > > I need to find sequences of length 11, which are made from ?all possible permutations with repetition (not the unique ones) of the letter string A with the other strings, for example AAAAAAAAAAB, AAAAAAAAAABC, AAAAAAAAACB, AABAAAAAAAB. A can be repeated 1-11 times in the sequence. > > Is there a way to do this in R? > Any help would be much appreciated. >So the sequence starts with 'A' and then has 10 from all possible values of those 17 letters? Have you computed how many sequences that is? If so, have you comprehended how big a number that is? It's 17^10 - it'll take about a day at a rate of a million per second. And then where do you put them? Do you still want to do this? Barry