Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jcpsantiago/9ada2fff118e8181ba3f60ebfb580afa to your computer and use it in GitHub Desktop.
Save jcpsantiago/9ada2fff118e8181ba3f60ebfb580afa to your computer and use it in GitHub Desktop.
## gather your data frames into a list
l <- list(cars = mtcars,
sleepy = sleep)
## export into individual CSV files
export_list <- function(list, folder = NULL) {
purrr::iwalk(
list,
~ readr::write_csv(.x, path = paste0(folder, .y, ".csv"))
)
# success!!!
print(paste(length(list), "tables exported!"))
}
# https://git.io/fA4DE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment