I have a big list that has a lot of sub-lists.
I would like to search for a specific column name and extract that column from every sub-list.
for example: please see the attached image, I have a big list named "List1", it has several sub-lists, for example, "gene A", "gene B", ...., "gene N". each of these sublists has a list, for example, "gene A" has these columns: a, b, c, ...... . "gene B" has a, d, ... z.
How can I search "a" in all those sublists and finally reach all of them beside each other in a data frame?
library(tidyverse)
(l1 <- list(
gene_A = list(a=1:3,
b=2:4,
z=3:5),
gene_B = list(a=9:7,
b=8:6,
c=7:5)
))
map_df(l1,
~pluck(.,"a"))
1 Like
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.