Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

how to source all fies from a directory in r

setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) # set the work directory
# to the same file location that the r script is in.
WD <- getwd() # get the current working directory

# Load the supporting scripts from the folder supporting scripts
files.sources = list.files(paste0(WD,'/supporting scripts/'))
files.sources = paste0(WD, '/supporting scripts/', files.sources)
sapply(files.sources, source)
 
PREVIOUS NEXT
Tagged: #source #fies #directory
ADD COMMENT
Topic
Name
4+3 =