Generating non-duplicate combination pairs in R

前端 未结 1 899
庸人自扰
庸人自扰 2020-12-17 14:41

Sorry for the non-descriptive title but I don\'t know whether there\'s a word for what I\'m trying to achieve.

Let\'s assume that I have a list of names of different

1条回答
  •  有刺的猬
    2020-12-17 15:17

    > x<-c('1','2','3','4')
    > combn(x,2)
         [,1] [,2] [,3] [,4] [,5] [,6]
    [1,] "1"  "1"  "1"  "2"  "2"  "3" 
    [2,] "2"  "3"  "4"  "3"  "4"  "4"
    

    0 讨论(0)
提交回复
热议问题