Re: [R] Generating permutations that always include one specific element

2009-12-19 Thread David Winsemius
On Dec 18, 2009, at 6:27 PM, Raymond Danner wrote: Dear R community, I am trying to create a matrix of permutations of a vector: bands <- c("AL", "B", "DB", "DG", "G", "K", "LB", "LG", "MG", "O", "P", "PI", "PK", "PU", "R", "V", "W", "Y") Each permutation must be 4 characters long. permuta

Re: [R] Generating permutations that always include one specific element

2009-12-19 Thread Stephan Kolassa
Hi Ray, First possibility: just select those combinations that contain "AL": combos.with.AL <- possible.combos[rowSums(possible.combos=="AL")>0,] Second possibility: create all 3-combos *without* "AL": bands.without.AL <- c("B", "DB", "DG", "G", "K", "LB", "LG", "MG", "O", "P", "PI", "PK", "PU"

[R] Generating permutations that always include one specific element

2009-12-19 Thread Raymond Danner
Dear R community, I am trying to create a matrix of permutations of a vector: bands <- c("AL", "B", "DB", "DG", "G", "K", "LB", "LG", "MG", "O", "P", "PI", "PK", "PU", "R", "V", "W", "Y") Each permutation must be 4 characters long. permutations() from the gtools package does this easy enough: pos