Skip to content

Instantly share code, notes, and snippets.

@johnatasjmo
Created January 20, 2018 16:44
Show Gist options
  • Save johnatasjmo/f6073976b5e1aac3d755ee1852a3aca5 to your computer and use it in GitHub Desktop.
Save johnatasjmo/f6073976b5e1aac3d755ee1852a3aca5 to your computer and use it in GitHub Desktop.
R - Source all files within folder
setwd("~/rProgramming")
files.sources = list.files()
sapply(files.sources, source)
@laurettemhlanga
Copy link

Thank you so much :)

@nprompt2
Copy link

excellent idea. just to add on to it. One may not aways be able to change the working directory and in that case, drop the setwd() function. Then, add the path to list.files() as list.files(path="~/rProgramming")

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