Skip to content

Instantly share code, notes, and snippets.

@ibombonato
Created February 2, 2017 15:16
Show Gist options
  • Save ibombonato/02eea96413dd6a7df5cb38054b2c731c to your computer and use it in GitHub Desktop.
Save ibombonato/02eea96413dd6a7df5cb38054b2c731c 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