合并两个列表具有不同的结构我已经vendor_listR中
vendor_list[57:59]
[[1]]
[1] "ibm"
[[2]]
[1] "apache" "canonical" "apple" "novell"
[[3]]
[1] "gnu" "oracle"
而且我有problemtype_list
problemtype_list[57:59]
[[1]]
[1] "NVD-CWE-Other"
[[2]]
[1] "NVD-CWE-Other"
[[3]]
[1] "CWE-824"
我需要将它们结合起来,使数据帧,从而使得
A B
ibm NVD-CWE-Other
apache NVD-CWE-Other
canonical NVD-CWE-Other
apple NVD-CWE-Other
novelle NVD-CWE-Other
gnu CWE-824
oracle CWE-824
我看过类似的问题Combine two lists in a dataframe in R
但它给我的错误
do.call(rbind, Map(data.frame, A=problemtype_list, B=vendor_list))
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 1, 0
编辑
我的每一个列表的结构
str(vendor_list)
$ : chr "cisco"
$ : NULL
$ : chr [1:5] "redhat" "novell" "debian" "oracle" ...
$ : chr [1:4] "redhat" "novell" "debian" "google"
$ : chr [1:4] "redhat" "novell" "debian" "google"
str(problemtype_list)
$ : chr "CWE-254"
$ : chr "CWE-79"
$ : chr "NVD-CWE-Other"
$ : chr "NVD-CWE-Other"
$ : chr "CWE-254"
$ : chr "CWE-189"
$ : chr "CWE-119"
(我是对的。你有'vendor_list'空元素!) – r2evans
其实空元素不会引发错误。 NULL,但是,会。你可以快速地用空字符串或任何你喜欢的东西替换那些NULL。 – Troy