Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将R函数作为带参数的命令行脚本运行_R_Command Line - Fatal编程技术网

将R函数作为带参数的命令行脚本运行

将R函数作为带参数的命令行脚本运行,r,command-line,R,Command Line,假设我有以下脚本 k <- as.numeric(readline("Start Index: ")) tot <- NULL for (i in 1:k){ tot <- c(tot, i) } write.csv(tot, "test.csv") k您可能会发现命令参数中的信息很有用 根据描述: Provides access to a copy of the command line arguments supplied when this R sessi

假设我有以下脚本

k <- as.numeric(readline("Start Index: "))
tot <- NULL

for (i in 1:k){
    tot <- c(tot, i)
}
write.csv(tot, "test.csv")

k您可能会发现
命令参数中的信息很有用

根据描述:

 Provides access to a copy of the command line arguments supplied
 when this R session was invoked.

您可能会发现
?commandArgs
中的信息很有用

根据描述:

 Provides access to a copy of the command line arguments supplied
 when this R session was invoked.

一对漂浮着,一对漂浮着,