[R] How to get all possible combinations?

Berend Hasselman bhh at xs4all.nl
Wed Mar 28 22:13:49 CEST 2012


On 28-03-2012, at 21:17, Somnath Dhar wrote:

> 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?

?combn

Berend



More information about the R-help mailing list