thanks petr, what if I got 200 elements, so I have to write expand.grid(x1=1, x2=1:2, x3=1:3, x4=1:3, x5=1:3....x200=1:3))?
Many thanks yan -- View this message in context: http://r.789695.n4.nabble.com/function-for-grouping-tp4324436p4327812.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.