-1

我正在尝试使用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" ...

我错过了什么?

4

1 回答 1

4

你能用这个命令看看它是否有效吗?它对我有用。

combn(LETTERS[1:5],3, FUN=paste0, collapse = "")
于 2018-09-24T13:19:11.643 回答