[R] Listing all of combinations

Muhammad Subianto msubianto at gmail.com
Fri Jul 14 19:09:25 CEST 2006


On this day 14/07/2006 15:35, miao wrote:
> Dear All:
>
>     I want to list all of combination among (a,b,c,d,e,f,g,h). I try to use lp<-ist(A=c(a,b,c,d,e,f,g,h),B=(a,b,c,d,e,f,g,h)....etc.).and then use expand.grid(p). this does not work for the same vector A,B...
>
>     Anyone had this experince?
>
>
>    Thanks!
>
>    Xin
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

Try this below:

A <- letters[1:8]
B <- letters[1:8]
lp<-list(A,B)
expand.grid(lp)

Best, Muhammad Subianto



More information about the R-help mailing list