我有一个Bash脚本,它创建了一个CSV文件和一个从该文件创建图形的R脚本。
在Bash脚本的末尾,我调用Rscript Graphs.R 10
。
我收到的响应如下:
Error in is.vector(X) : subscript out of bounds
Calls: print ... <Anonymous> -> lapply -> FUN -> lapply -> is.vector
Execution halted
我Graphs.R文件的前几行是:
#!/bin/Rscript
args <- commandArgs(TRUE)
CorrAns = args[1]
我不知道我做错了什么?网上的建议似乎告诉我这应该行得通。很难理解commandArgs
。
print(as.numeric(commandArgs(TRUE)[1]))
打印出[1] 10
。 - moinudinas.numeric()
对您不起作用吗?如果您需要使用“eval”,请在页面末尾的标有“您的答案”的文本框中发表它。然后通过单击答案右上角的勾选框来接受最佳答案。 - moinudin