I have a list abc = list(c(1,2), 3, c(4,5,6))
I want to create a data frame df
with 1 column df$col1
which looks like the following:
[[1]]
[1] 1 2
[[2]]
[1] 3
[[3]]
[1] 4 5 6
How do I do this? Running df = data.frame(abc = list(c(1,2), 3, c(4,5,6)))
gives the error
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 2, 1, 3
because data.frame() looks to convert this list into a >1 column data frame, spreading the each list element over different columns, and I can't find any argument in data.frame which stops it from doing so.