我有一个命名元素列表(testlist),其中一些名称是重复的
$x
[1] "one"
$x
[1] "two"
$y
[1] "three"
$y
[1] "four"
Run Code Online (Sandbox Code Playgroud)
我试图最终得到一个数据表,它将元素与通用名称组合到同一列中.
x y
1: one three
2: two four
Run Code Online (Sandbox Code Playgroud)
我试过了
testdf <- do.call(cbind, lapply(testlist, data.table))
Run Code Online (Sandbox Code Playgroud)
但最终只有:
x.V1 x.V1 y.V1 y.V1
1: one two three four
Run Code Online (Sandbox Code Playgroud)
有什么建议?感谢帮助!