[R] unique combinations

Antje Niederlein niederlein-rstat at yahoo.de
Wed Dec 21 08:59:15 CET 2011


Hi there,

I have a vector and would like to create a data frame, which contains
all unique combination of two elements, regardless of order.

myVec <- c(1,2,3)

what expand.grid does:

1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3

what I would like to have

1,1
1,2
1,3
2,2
2,3
3,3

Can anybody help?



More information about the R-help mailing list