R - List All Combinations With combn (Multiple m Values) [duplicate]
问题 This question already has answers here : All combinations of all sizes? (2 answers) Unordered combinations in R (2 answers) Closed last year . I would like to build a dataframe that lists all possible combinations of 6 numbers. I realised that I can use combn(), but with only one value for m. With a bit of playing around I got the desired result by going through step-by-step with the following code - combi1 <- data.frame(c(1:6)) colnames(combi1) <- 'X1' combi2 <- data.frame(t(combn(c(1:6), 2)