-1

I have 100 data frames called df1, df2, df3 ...... df100. How can I use the rbind function without typing the name of every single data frame?

1 Answers1

1

You can do paste0("df", 1:100) to generate the vector of the dataframe names. Then mget(paste0("df", 1:100)) gives the dataframes in a list. And you can use do.call to call rbind on this list; finally the command is:

do.call(rbind, mget(paste0("df", 1:100)))
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225