I have solved my problem using:
x-1:4
x
[1] 1 2 3 4
combn(x,2)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]111223
[2,]234344
Thanks Emma
emj83 wrote:
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
--
View this message in context:
http://www.nabble.com/pairs-of-numbers-tp22494116p22494346.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.