I am trying to transform a list of lists into data frames of list. The sub lists, however, have same number of columns but "different number of rows". When I run the command as.data.frame(parent_list), it generates: "Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows" errors. How can I convert this into a list of data frames with each frame having a different number of rows? I have tried solutions using different threads but no luck. Any help would be appreciated. Here is a sample code:
# making a list of 2 sub lists with different number of elements.
list <- list(A = c(1,2,3), B = c(1,2))
# trying to convert sub lists into data frames.
list_to_dataframe <- as.data.frame(list)
#> Error: "Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
#> : arguments imply differing number of rows: 3, 2"
Thanks!