我正在尝试使用combn()
withpaste0
作为函数创建字符串组合列表,但我得到的只是组合矩阵。我究竟做错了什么?
例子:
combn(LETTERS[1:5],3, FUN=paste0)
给我:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] "A" "A" "A" "A" "A" "A" "B" "B" "B" "C"
[2,] "B" "B" "B" "C" "C" "D" "C" "C" "D" "D"
[3,] "C" "D" "E" "D" "E" "E" "D" "E" "E" "E"
当我期望得到的是类似的东西时:
[1] "ABC" "ABD" "ABE" "ACD" "ACE" "ADE" ...
我错过了什么?