【发布时间】:2019-02-18 00:33:27
【问题描述】:
我正在尝试使用 getopt 包打开我的文件,但代码似乎不起作用:
> library(getopt)
args <- commandArgs(trailingOnly = FALSE)
spec = matrix(c(
'help' , 'h', 0, "character",
'input' , 'i', 1, "file",
'output' , 'o', 1, "character"), byrow=TRUE, ncol=4)
opt = getopt(spec)
if(opt$input){
file <- read.table(args[1])
}
print(file)
我正在尝试使用命令行来运行以下代码:
Rscript --slave filename.R -i file.txt
错误信息是: storage.mode(peek.optstring) tryCatchList -> tryCatchOne -> doTryCatch 执行停止 有人可以帮帮我吗?
【问题讨论】: