Combining Lists of Multiple Dataframes in R -
for simplicity, have made following code.
df1 <- data.frame(a=c(1:3), b=c('a', 'a', 'a', 'b', 'b', 'b')) df2 <- data.frame(c=c('d'), d=c(4, 4, 5, 5, 6, 6)) 1 <- split(df1, df1$b) 2 <- split(df2, df2$d) goal_df <- data.frame(a=c(1:3), b=c('a', 'a', 'a', 'b', 'b', 'b'), c=c('d'), d=c(4, 4, 5, 5, 6, 6))
i have 2 lists 'one' , 'two'. lists contain several thousand data frames. want combine of these 1 data frame. tried rbind, ran issues because dimensions of data frames in list vary. end result should have called goal_df
we can use
library(rowr) do.call(cbind.fill, c(list(do.call(rbind, one), do.call(rbind, two)), fill = na))
Comments
Post a Comment