1
命令行腳本可以說我有以下腳本運行v功能與參數
k <- as.numeric(readline("Start Index: "))
tot <- NULL
for (i in 1:k){
tot <- c(tot, i)
}
write.csv(tot, "test.csv")
我想在命令行中運行此腳本。我如何運行它,以便它仍然要求用戶輸入(k
)。否則,我可以在CMD命令中添加k
的值作爲參數嗎?我在Linux上。
幾個這些漂浮[鏈接](http://stackoverflow.com/questions/4547789/command-line-arguments-in-bash-to-rscript), [鏈接](http://stackoverflow.com/questions/3433603/parsing-command-line-arguments-in-r-scripts),[鏈接](http://stackoverflow.com/questions/4808169/r-command -line-通過-A-文件名到腳本功能於參數窗口),[鏈接](http://stackoverflow.com/questions/1110363/is-there-a-package-to-process-command- line-options-in-r),[link](http://stackoverflow.com/questions/2151212/how-can-i-read-command-line-parameters-from-an-r-script) – GSee