0
目标是使用文件夹中的所有脚本(默认)或用户在参数中定义的脚本。带R的文件中的错误
如果我输入默认:
RScript.exe Detection.r --detection ALL
结果看起来像(没问题):
[1] "script1" "script2"
[3] "script3"
但是如果我手动定义脚本中使用:
RScript.exe Detection.r --detection algo1,algo2
结果如下所示:
[[1]]
[1] "algo1" "algo2"
而且我有这样的错误:
Error in file(filename, "r", encoding = encoding) :
argument 'description' incorrect
我不知道为什么它不工作。
顺便说一句,这里是代码处理这个问题:
if(opt$detectionMethods =='ALL') {
detectionMethods <- list.files(paste(projectBasePath, '/modules/detections', sep=''))
detectionMethods <- gsub("\\.r", "", detectionMethods)
} else {
detectionMethods <- strsplit(opt$detectionMethods, ",")
}
'unlist'在我的情况下就像一个魅力,不知道那是如此简单。非常感谢 ! – pakzs
与R中的许多事情一样,一旦你知道它很容易;)。 –