Skip to content

pairs of numbers

2 messages · emj83

#
Hi,

I have two lists of numbers which are both 1,2,3,4.
I would like to combine pairs so that I have:
1,2
1,3
1,4
2,3
2,4
3,4.

I know that expand.grid() can give me all combinations of pairs. 

Any suggestions would be much appreciated.

Emma
#
I have solved my problem using:
[1] 1 2 3 4
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    1    1    2    2    3
[2,]    2    3    4    3    4    4

Thanks Emma
emj83 wrote: