[R] How to get all possible combinations?

Somnath Dhar somnath700001 at gmail.com
Wed Mar 28 21:17:29 CEST 2012


Dear all, suppose I have a vector with elements as:

Vec <- c(2,3,4,5,6)

Now I want to have all possible combination of length 3 using those
elements and without any repetition. Like, I want to have 1
possibility like 2-3-4 but not 3-2-4.

Can somebody guide me how to achieve that in R?

Thanks for your help.



More information about the R-help mailing list