[英]add list-column with data.frames in each cell to a data.frame
I am trying to add a list-column containing data.frames in each position/cell of the list to a main data.frame我正在尝试将列表的每个位置/单元格中包含 data.frames 的列表列添加到主 data.frame
meta <- data.frame(n=1:2,
d = list(iris,mtcars))
but this yields an error message:但这会产生一条错误消息:
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 150, 32
MY desired output is the meta data.frame with 2 rows and two columns.我想要的 output 是具有 2 行和 2 列的元数据帧。
The data.frame
function doesn't handle list arguments the way you want, but you can add a list column after the fact data.frame
function 不会按照您想要的方式处理列表 arguments,但您可以在事后添加列表列
meta <- data.frame(n = 1:2)
meta$d <- list(iris, mtcars)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.