Hi, expand.grid(X) # Var1 Var2 Var3 #1 1 1 1 #2 2 1 1 #3 1 2 1 #4 2 2 1 #5 1 1 2 #6 2 1 2 #7 1 2 2 #8 2 2 2 expand.grid(1:2,1:2,1:2) # Var1 Var2 Var3 #1 1 1 1 #2 2 1 1 #3 1 2 1 #4 2 2 1 #5 1 1 2 #6 2 1 2 # 1 2 2 #8 2 2 2 A.K.
----- Original Message ----- From: Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> To: r-help <r-help@r-project.org> Cc: Sent: Friday, February 1, 2013 8:48 AM Subject: [R] expand.grid on contents of a list Hello! I have a list of variable length. One example is: X=vector("list",3) X[[1]]=1:2 X[[2]]=1:2 X[[3]]=1:2 How could I run expand.grid on the elements of X so that the results would be the same as expand.grid(1:2,1:2,1:2)? Thank you! Dimitri -- Dimitri Liakhovitski gfk.com <http://marketfusionanalytics.com/> [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.