I have a data frame with two lists of variables. Each observation in the list contains different length of elements. For example the 4th of the variable “accession” contains one element but 7th contains two elements. current dataframe
I want to make a new data frame combine two lists together which looks like: final dataframe I want
Thanks for helping me!
This is data frame I am currently having.
library(rentrez)
search <- entrez_search(db="gds", term=paste0("disease", " AND gse[ETYP]") , retMax = 15)
id <- unlist(search$ids)
UID <- c(sapply(id, paste0, collapse=""))
pub.summary <- entrez_summary(db = "gds", id = UID ,
always_return_list = TRUE)
summary <- extract_from_esummary(esummaries = pub.summary ,
elements = c("samples"),
simplify = T)
df <- data.frame(summary)
df <-data.frame(t(df))
df <- df %>% mutate()
df
This is the data frame result I wish to have
# accession title
#1 GSM3955152 Cancer3
GSM3955155 Adjacent3
GSM3955757 SW480 cells, HES1-binding RNAs/LncRNAs
GSM3955153 Adjacent1
GSM3955150 Cancer1
GSM3955151 Cancer2
#2 GSM33026213 his4wk_sensitized_uti_1
GSM3302681 3his4wk_resolved_pbs_2
GSM3302624 c57bl6j_pbs_9
.
.
.
.
#4 GSM3955757 SW480 cells, HES1-binding RNAs/LncRNAs
.
.
.
.
#15 GSM3934992 control rep4 [N_0039]
GSM3935006 control rep15 [W_010]
GSM3935012 control rep17 [W_023]
GSM3934989 control rep1 [N_0026]
END