[R] Concatenating elements from lists via combinations

S Ellison S.Ellison at LGCGroup.com
Fri Mar 6 11:18:55 CET 2015



> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Alrik Thiem
> 
> lst <- list(c("a","aB","aBC","aC","B","BC","C"), c("B","Bc","c"), c("D"))
> 
 > How could I create an exhaustive list of length 21 now, each of whose elements
> contains a unique combination of vector elements? 

do.call(expand.grid, lst)

S Ellison


*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list