[R] All possible permutations of letter A with other letters

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Jun 30 17:48:39 CEST 2010


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



More information about the R-help mailing list