📜  如何从目录中获取所有文件 - R 编程语言代码示例

📅  最后修改于: 2022-03-11 14:51:59.705000             🧑  作者: Mango

代码示例1
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)