Mass rbind.fill for many data frames

后端 未结 4 1737
迷失自我
迷失自我 2020-12-20 03:04

I am attempting to row bind many data frames together into a single massive data frame. The data frames are named sequentially with the first named df1, the se

4条回答
  •  青春惊慌失措
    2020-12-20 04:02

    do.call comes handy. The function you specify works on a list of arguments.

    library(plyr)
    df.fill <- lapply(ls(pattern = "df"), get)
    df <- do.call("rbind.fill", df.fill)
    
    > str(df)
    'data.frame':   10000 obs. of  2 variables:
     $ x: int  1 2 3 4 5 6 7 8 9 10 ...
     $ y: num  1 11.1 21.2 31.3 41.4 ...
    

提交回复
热议问题