[英]How put Dataframe into one cell as list in R
i'm trying to put a dataframe as list in one cell in R, but when i try to do i get a warning msg and only is saved the first column我正在尝试将 dataframe 作为列表放在 R 的一个单元格中,但是当我尝试这样做时,我收到一条警告消息,并且只保存了第一列
library(tidyverse)
list1 <- list(A = "A1", B = "B1", C = "C1") # Create first example list
list1
list2 <- list(A = "A2", B = "B2", C = "C2") # Create second example list
list2
list12 <- Map(c, list1, list2) %>% as.data.frame() # Merge two lists
list12
Test_ <- "Row1" %>% as.data.frame()
Test_$list[1] <- list12
This is the error这是错误
Warning message:
In Test_$list[1] <- list12 :
number of items to replace is not a multiple of replacement length
I want to have something like this, have a kind of subtable into my dataframe:我想要这样的东西,在我的 dataframe 中有一种子表:
Thanks
谢谢
We can wrap with list
on the object list12
which is a data.frame
我们可以用 object
list12
上的list
包装,这是一个data.frame
Test_$list[1] <- list(list12)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.