I have a nested dataframe of tibbles with the following structure:
df <- structure(list(V1 = list(structure(list(var1 = c("tst", "tst"
), var2 = c(1L, 1L), var3 = c(9L, 9L), var4 = c(1L, 1L), var5 = 1:2,
var6 = c("Don’t shortchange public trust in science", NA),
var7 = c("11 September 2020", NA), var8 = c("Editorial",
NA)), row.names = c(NA, -2L), class = c("tbl_df", "tbl",
"data.frame")), structure(list(var1 = c("tst", "tst"), var2 = c(1L,
1L), var3 = c(9L, 9L), var4 = c(2L, 2L), var5 = 1:2, var6 = c("Tailoring immunotherapy with liquid biopsy",
"Pseudovirus for immunotherapy"), var7 = c("18 September 2020",
"10 August 2020"), var8 = c("News & Views", "News & Views")), row.names = c(NA,
-2L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
var1 = c("tst", "tst"), var2 = c(2L, 2L), var3 = c(9L, 9L
), var4 = c(1L, 1L), var5 = 1:2, var6 = c("Before clicking the ‘submit’ button",
NA), var7 = c("23 September 2021", NA), var8 = c("Editorial",
NA)), row.names = c(NA, -2L), class = c("tbl_df", "tbl",
"data.frame")), structure(list(var1 = c("tst", "tst"), var2 = c(2L,
2L), var3 = c(9L, 9L), var4 = c(2L, 2L), var5 = 1:2, var6 = c("Immunoradiotherapy goes club(bing)",
"Splitting signals drives CARs further"), var7 = c("20 September 2021",
"23 September 2021"), var8 = c("News & Views", "News & Views"
)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"
))), V2 = list(structure(list(var1 = c("tst", "tst"), var2 = c(1L,
1L), var3 = c(10L, 10L), var4 = c(1L, 1L), var5 = 1:2, var6 = c("What next for postdocs?",
NA), var7 = c("09 October 2020", NA), var8 = c("Editorial", NA
)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"
)), structure(list(var1 = c("tst", "tst"), var2 = c(1L, 1L),
var3 = c(10L, 10L), var4 = c(2L, 2L), var5 = 1:2, var6 = c("Optimizing CARs for ocular delivery",
"mtDNA mutations help support cancer cells"), var7 = c("12 October 2020",
"19 October 2020"), var8 = c("News & Views", "News & Views"
)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"
)), structure(list(var1 = c("tst", "tst"), var2 = c(2L, 2L),
var3 = c(10L, 10L), var4 = c(1L, 1L), var5 = 1:2, var6 = c("The labors of referees",
NA), var7 = c("22 October 2021", NA), var8 = c("Editorial",
NA)), row.names = c(NA, -2L), class = c("tbl_df", "tbl",
"data.frame")), structure(list(var1 = c("tst", "tst"), var2 = c(2L,
2L), var3 = c(10L, 10L), var4 = c(2L, 2L), var5 = 1:2, var6 = c("A PRC1–RNF2 knockout punch for cancer",
"A quick guide for clinical oncology"), var7 = c("22 October 2021",
"22 October 2021"), var8 = c("News & Views", "News & Views")), row.names = c(NA,
-2L), class = c("tbl_df", "tbl", "data.frame"))), V3 = list(structure(list(
var1 = c("tst", "tst"), var2 = c(1L, 1L), var3 = c(11L, 11L
), var4 = c(1L, 1L), var5 = 1:2, var6 = c("Rise of the preprints",
NA), var7 = c("17 November 2020", NA), var8 = c("Editorial",
NA)), row.names = c(NA, -2L), class = c("tbl_df", "tbl",
"data.frame")), structure(list(var1 = c("tst", "tst"), var2 = c(1L,
1L), var3 = c(11L, 11L), var4 = c(2L, 2L), var5 = 1:2, var6 = c("Future directions in preclinical and translational cancer neuroscience research",
NA), var7 = c("17 November 2020", NA), var8 = c("Comment", NA
)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"
)), structure(c(NA, NA), .Dim = 2:1, .Dimnames = list(c("result.1",
"result.2"), NULL)), structure(c(NA, NA), .Dim = 2:1, .Dimnames = list(
c("result.1", "result.2"), NULL))), V4 = list(structure(list(
var1 = c("tst", "tst"), var2 = c(1L, 1L), var3 = c(12L, 12L
), var4 = c(1L, 1L), var5 = 1:2, var6 = c("Tackling the shadow pandemic",
NA), var7 = c("16 December 2020", NA), var8 = c("Editorial",
NA)), row.names = c(NA, -2L), class = c("tbl_df", "tbl",
"data.frame")), structure(list(var1 = c("tst", "tst"), var2 = c(1L,
1L), var3 = c(12L, 12L), var4 = c(2L, 2L), var5 = 1:2, var6 = c("Mutagenic exposures shape immunotherapy responses",
"How to kill Treg cells for immunotherapy"), var7 = c("16 December 2020",
"16 December 2020"), var8 = c("News & Views", "News & Views")), row.names = c(NA,
-2L), class = c("tbl_df", "tbl", "data.frame")), structure(c(NA,
NA), .Dim = 2:1, .Dimnames = list(c("result.1", "result.2"),
NULL)), structure(c(NA, NA), .Dim = 2:1, .Dimnames = list(
c("result.1", "result.2"), NULL))), V5 = list(structure(c(NA,
NA), .Dim = 2:1, .Dimnames = list(c("result.1", "result.2"),
NULL)), structure(c(NA, NA), .Dim = 2:1, .Dimnames = list(
c("result.1", "result.2"), NULL)), structure(c(NA, NA), .Dim = 2:1, .Dimnames = list(
c("result.1", "result.2"), NULL)), structure(c(NA, NA), .Dim = 2:1, .Dimnames = list(
c("result.1", "result.2"), NULL)))), row.names = c(NA, -4L
), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x0000015e6de41ef0>)
For the first two columns of tibbles I am able to use bind_rows
and get the desired output:
bind_rows(bind_rows(df$V1),bind_rows(df$V2))
When I try to bind additional rows with missing information bind_rows
gives an error:
bind_rows(bind_rows(df$V1),bind_rows(df$V2),bind_rows(df$V3))
Error: Argument 3 must have names.
I was able to get this far using this example. I was thinking of trying to use the map
function like in this example, but I cannot get it to work.
Edit: updated error code