I would like to read in all of the *.csv files in a directory using purrr::map, and I just wanted to ask if there's a better way than what I'm doing, particularly if it's from the tidyverse or easier to read.
In particular, would you use file.path()? Is there a simpler way, or an easier to read way?
library(tidyverse)
csv_filenames <- list.files(path = "raw_data/")
dfs <- map(csv_filenames, ~read_csv(file.path("raw_data/", .)))
df <- bind_rows(dfs)
.csvfiles have the same column structure, you can just usemap_df()to get thedata.frameoutput - EJJ