Skip to content

Instantly share code, notes, and snippets.

@tanerumit
Last active January 16, 2021 13:43
Show Gist options
  • Save tanerumit/dd7eca6f9aacf778730be0580592ebf6 to your computer and use it in GitHub Desktop.
Save tanerumit/dd7eca6f9aacf778730be0580592ebf6 to your computer and use it in GitHub Desktop.
#R #function to source all scripts in a directory
### Sourcing
sourceDir <- function(path, trace = TRUE, ...) {
for (nm in list.files(path, pattern = "\\.[RrSsQq]$")) {
if(trace) cat(nm,":")
source(file.path(path, nm), ...)
if(trace) cat("\n")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment