我有大约 30 个研究项目的功能,不想打字
source(paste("C:/functions","/function1.txt",sep=""))
30 次 whereC:/functions
是我的函数目录,并且/function1.txt
是一个特定的函数。
我试过了
files <- list.files("C:/functions")
sapply(1:length(files),source(paste("C:/functions/",files[i],sep="")))
它不起作用。错误信息:Error in match.fun(FUN) :
c("'source(paste(\"C:/functions/\", ' is not a function, character or symbol", "' files[i], sep = \"\"), TRUE)' is not a function, character or symbol")
我也用for
循环尝试过,它不起作用。