我有以下3个变量(1个字符串和2个数据帧):
library(tidyverse)
# Variable to use to construct tibble -------------------------------------
obsv_name <- "FOO"
dat1 <- structure(c(0.033, 0.066, 0.233,
0.0333333333333333), .Dim = c(2L, 2L), .Dimnames = list(c("CXX_4",
"YXRPW_112"), c("A", "R")))
dat2 <- structure(c(0.1, 0, 0.1, 0.033), .Dim = c(2L, 2L
), .Dimnames = list(c("XXX_62", "YYY_208"), c("A", "R")))
obsv_name
#> [1] "FOO"
dat1
#> A R
#> CXX_4 0.033 0.23300000
#> YXRPW_112 0.066 0.03333333
dat2
#> A R
#> XXX_62 0.1 0.100
#> YYY_208 0.0 0.033
我想要做的是构建一个包含3列的tibble,其中dat1
和dat2
需要构建为nested data frame。我怎么能这样做?
最终结果如下:
obsv_name data_frame1 data_frame2
FOO <list column of dat1> <list column of dat2>