Combine a list of data frames into one data frame

前端 未结 9 2163
半阙折子戏
半阙折子戏 2020-11-21 11:25

I have code that at one place ends up with a list of data frames which I really want to convert to a single big data frame.

I got some pointers from an earlier ques

9条回答
  •  别那么骄傲
    2020-11-21 12:03

    There is also bind_rows(x, ...) in dplyr.

    > system.time({ df.Base <- do.call("rbind", listOfDataFrames) })
       user  system elapsed 
       0.08    0.00    0.07 
    > 
    > system.time({ df.dplyr <- as.data.frame(bind_rows(listOfDataFrames)) })
       user  system elapsed 
       0.01    0.00    0.02 
    > 
    > identical(df.Base, df.dplyr)
    [1] TRUE
    

提交回复
热议问题