I want to read all csv-files in a directory into R and bind them together. I use vroom to read the files and map_dfr to apply the reader to all files and bind them together. This perfectly works for a few hundred files. However, I get the following error when applying it on 3000 files.
mapping error: Too many open files
My (simplified) pipe looks as follows:
library(vroom)
library(dplyr)
files <- list.files(path = "some_path", pattern = "*.csv", full.names = TRUE)
data_combined <- files %>%
map_dfr(vroom)
The files are only approximately 100kb each, hence memory shouldn't be an issue. If someone came across this problem as well or has an idea of how to solve it, I would very much appreciate your help.
PS: The same error occurs when using fread or readr to read the files. The problem is obviously with purrr's map function.
files[1:2] %>% map(vroom)what does it output - akrun