I have this:
res.list<-list(
list(
structure(list(A = 1L, B = "X2", D = 1L), class = "data.frame", row.names = c(NA, -1L)),
structure(list(A = 1L, B = "X3, X14, X17", D = 3L), class = "data.frame", row.names = c(NA, -1L)),
structure(list(A = 1L, B = "X4, X14, X17", D = 3L), class = "data.frame", row.names = c(NA, -1L)))
,
list(
structure(list(A = 2L, B = "X17, X19", D = 2L), class = "data.frame", row.names = c(NA, -1L)),
structure(list(A = 2L, B = "X2, X17, X19", D = 3L), class = "data.frame", row.names = c(NA, -1L)),
structure(list(A = 2L, B = "X3, X17, X19", D = 3L), class = "data.frame", row.names = c(NA, -1L))))
What is the most efficient and generic way to do the procedure below?
rbind(do.call(rbind.data.frame,res.list[[1]]),
do.call(rbind.data.frame,res.list[[2]]))
Best regards;
It may be easier with bind_rows
library(dplyr)
bind_rows(res.list)
A B D
1 1 X2 1
2 1 X3, X14, X17 3
3 1 X4, X14, X17 3
4 2 X17, X19 2
5 2 X2, X17, X19 3
6 2 X3, X17, X19 3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.