3
我想从Shell脚本调用R脚本并使用R CMD BATCH --no-save --no-restore
。 如何将shell脚本中的参数(例如$1
)转移到R脚本中?参数在R CMD BATCH模式下从Shell
我想从Shell脚本调用R脚本并使用R CMD BATCH --no-save --no-restore
。 如何将shell脚本中的参数(例如$1
)转移到R脚本中?参数在R CMD BATCH模式下从Shell
正如我写的其他地方,批处理命令行为有点怪异,有时,所以我就直接使用了--file命令:
R --slave --vanilla --file=myScript.R --args foo=2 bar=3 "s=string with spaces" > output.txt
...然后在myScript.R
我用args <- commandArgs(TRUE)
来获得额外的参数foo
etc ...