У меня есть тиббл с этой структурой (dput
ниже):
# A tibble: 7 x 3
Date CC Variance_Type
<fct> <list> <list>
1 2-17 <dbl [8 x 2]> <chr [8]>
2 2-18 <dbl [8 x 2]> <chr [8]>
3 2-19 <dbl [8 x 2]> <chr [8]>
4 2-20 <dbl [8 x 2]> <chr [8]>
5 2-21 <dbl [8 x 2]> <chr [8]>
6 2-22 <dbl [8 x 2]> <chr [8]>
7 2-23 <dbl [8 x 2]> <chr [8]>
Мой желаемый вывод - столбец 56 строк x 4, где:
- Элементы каждый из списков был выведен в отдельную строку.
- Значения в
Date
заполняют столбец, чтобы соответствовать элементам, которые в настоящее время находятся в их строке. - Столбцы вложенного таблицы в столбце
CC
разделены на отдельные столбцы.
Я пытался сделать это в тидиверсе с помощью комбинации mutate (), map () и bind_rows (), но я могу не заставит это работать. Любая помощь очень ценится.
Tibble:
structure(list(Date = structure(1:7, .Label = c("2-17", "2-18",
"2-19", "2-20", "2-21", "2-22", "2-23"), class = "factor"), CC = list(
structure(c(0.0292, 0.1803, 0.1063, 0.3555, 0.0227, 0.0471,
0.2588, 1, 2.92, 18.03, 10.63, 35.55, 2.27, 4.71, 25.88,
100), .Dim = c(8L, 2L), .Dimnames = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ",
"Common to Jsc, and Uoc ", "Common to Jsc, and FF ",
"Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Coefficient", " % Total"
))), structure(c(0.0414, 0.2307, 0.1813, 0.3428, 0.0408,
0.0137, 0.1494, 1, 4.14, 23.07, 18.13, 34.28, 4.08, 1.37,
14.94, 100), .Dim = c(8L, 2L), .Dimnames = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ",
"Common to Jsc, and Uoc ", "Common to Jsc, and FF ",
"Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Coefficient", " % Total"
))), structure(c(0.0348, 0.2298, 0.4534, 0.0453, 0.1252,
0.0406, 0.0709, 1, 3.48, 22.98, 45.34, 4.53, 12.52, 4.06,
7.09, 100), .Dim = c(8L, 2L), .Dimnames = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ",
"Common to Jsc, and Uoc ", "Common to Jsc, and FF ",
"Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Coefficient", " % Total"
))), structure(c(0.0693, 0.1241, 0.3104, 0.0885, 0.1706,
0.0563, 0.1807, 1, 6.93, 12.41, 31.04, 8.85, 17.06, 5.63,
18.07, 100), .Dim = c(8L, 2L), .Dimnames = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ",
"Common to Jsc, and Uoc ", "Common to Jsc, and FF ",
"Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Coefficient", " % Total"
))), structure(c(0.0431, 0.1621, 0.3896, 0.2243, 0.1005,
-0.0339, 0.1143, 1, 4.31, 16.21, 38.96, 22.43, 10.05, -3.39,
11.43, 100), .Dim = c(8L, 2L), .Dimnames = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ",
"Common to Jsc, and Uoc ", "Common to Jsc, and FF ",
"Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Coefficient", " % Total"
))), structure(c(0.0656, 0.1021, 0.2638, 0.1299, 0.2102,
0.0061, 0.2223, 1, 6.56, 10.21, 26.38, 12.99, 21.02, 0.61,
22.23, 100), .Dim = c(8L, 2L), .Dimnames = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ",
"Common to Jsc, and Uoc ", "Common to Jsc, and FF ",
"Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Coefficient", " % Total"
))), structure(c(0.0802, 0.1114, 0.6962, 0.0845, 0.1544,
-0.0958, -0.0309, 1, 8.02, 11.14, 69.62, 8.45, 15.44, -9.58,
-3.09, 100), .Dim = c(8L, 2L), .Dimnames = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ",
"Common to Jsc, and Uoc ", "Common to Jsc, and FF ",
"Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Coefficient", " % Total"
)))), Variance_Type = list(c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ", "Common to Jsc, and Uoc ",
"Common to Jsc, and FF ", "Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ", "Common to Jsc, and Uoc ",
"Common to Jsc, and FF ", "Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ", "Common to Jsc, and Uoc ",
"Common to Jsc, and FF ", "Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ", "Common to Jsc, and Uoc ",
"Common to Jsc, and FF ", "Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ", "Common to Jsc, and Uoc ",
"Common to Jsc, and FF ", "Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ", "Common to Jsc, and Uoc ",
"Common to Jsc, and FF ", "Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "), c("Unique to Jsc ",
"Unique to Uoc ", "Unique to FF ", "Common to Jsc, and Uoc ",
"Common to Jsc, and FF ", "Common to Uoc, and FF ", "Common to Jsc, Uoc, and FF",
"Total "))), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -7L))