0

I have hundreds of dataframes whose names end either with "_flow" or "_rain", and I would like to rbind them all into two dataframes – one for flow data and one for rain data.

I guess the equivalent of this in Linux would be:

cat *_flow.csv >> flow.csv
cat *_rain.csv >> rain.csv

How do I do this in R?

1 Answers1

1

Here is one way to find the files and rbind them:

files <- grep("_flow|_rain", dir(), value = TRUE)
  
library(vroom)

data <- vroom(files)
stevec
  • 27,285
  • 13
  • 133
  • 181