Skip to content

Instantly share code, notes, and snippets.

@jananiravi
Last active December 2, 2019 21:30
Show Gist options
  • Save jananiravi/21e284deb6f5602136ac12c29fb1b5c0 to your computer and use it in GitHub Desktop.
Save jananiravi/21e284deb6f5602136ac12c29fb1b5c0 to your computer and use it in GitHub Desktop.
To source all R scripts within a single folder with tidyverse>purrr>map!
# If you want to use `tidyverse` to do this, you could use the `map` function to simplify!
my_path <- c("/path/to/files/") # set your path
source_files <- list.files(my_path, "*.R") # locate all .R files
map(paste0(my_path, source_files), source) # source all your R scripts!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment