0

Have 68 data frames with the same structure and columns. I started to use rbind and after typing in about 30 df names, I thought there might be an easier way to concatenate all the data frames without typing in each name. I mean, what if you have 100,000 data frames to concatenate? I looked at a dozen of online resources including this site and didn't find exactly what I was looking for.

All the 68 data frames are named sequentially. For example: df_01, df_02, ... up to df_68. I tried to do rbind(df_01:df_68) and of course this did not work.

nrussell
  • 18,382
  • 4
  • 47
  • 60
Elan
  • 539
  • 1
  • 6
  • 18
  • 3
    Put the names in a list and then bind them together. Maybe [this](http://stackoverflow.com/questions/32888757/reading-multiple-files-into-r-best-practice/32888918#32888918) can help you. – Jaap Mar 16 '16 at 13:48
  • 2
    Also `do.call("rbind", mget(sprintf("df_%02d", 1:5)))`. – nrussell Mar 16 '16 at 13:54
  • How did you wind up with all those data.frames? It seems like you might not be doing things "The R Way." R is different than SAS. – MrFlick Mar 16 '16 at 14:44
  • I downloaded bunch of text files from a government site. Had I thought of combining the text files into one before importing into R, it would have been easier – Elan Mar 16 '16 at 14:47

0 Answers0