Skip to content

Instantly share code, notes, and snippets.

@ColinFay
Last active March 6, 2019 16:18
Show Gist options
  • Save ColinFay/d74d331825868b181860212cd1577b69 to your computer and use it in GitHub Desktop.
Save ColinFay/d74d331825868b181860212cd1577b69 to your computer and use it in GitHub Desktop.
library(tidyverse)
files <- list.files("../open-data/", pattern = "^2017", full.names = TRUE)
full <- map_df(files, read_csv)
dplyr::glimpse(full)
# With names
files <- list.files("../open-data/", pattern = "^2017", full.names = TRUE) %>%
set_names(basename(.))
full <- map_df(files, read_csv, .id = "file")
@RickinOz
Copy link

RickinOz commented Mar 6, 2018

Thanks for this post: https://twitter.com/_colinfay/status/949023275534946304?lang=en
I watched https://www.rstudio.com/resources/webinars/whats-new-with-readxl/ but didn't know how to pass the filename as the .id
This was showing the sheet but felt short of telling how to pass the name.
Thanks for the quick script above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment