Created
January 20, 2018 16:44
-
-
Save johnatasjmo/f6073976b5e1aac3d755ee1852a3aca5 to your computer and use it in GitHub Desktop.
R - Source all files within folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setwd("~/rProgramming") | |
files.sources = list.files() | |
sapply(files.sources, source) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note - for this to work you also need to have
full.names = TRUE
within the list.files function so that when you call source in the sapply function it has the path information for each file, which will be required since you didn't change your working directory. I.e.list.files(path="~/rProgramming", full.names = TRUE)
.