Skip to content

Instantly share code, notes, and snippets.

@davidclarance
Forked from ibombonato/read_all_csv_purrr.r
Last active September 20, 2018 15:16
Show Gist options
  • Save davidclarance/1772153cc603dac692665cbc82847b30 to your computer and use it in GitHub Desktop.
Save davidclarance/1772153cc603dac692665cbc82847b30 to your computer and use it in GitHub Desktop.
R - Read all csv in folder with purrr
library(tidyverse)
files <- list.files(path = "./data/", pattern = "*.csv")
df <- files %>%
map(function(x) {
read_csv(paste0("./data/", x))
}) %>%
reduce(rbind)
# Reference: http://serialmentor.com/blog/2016/6/13/reading-and-combining-many-tidy-data-files-in-R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment