Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.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
从CMD窗口执行R程序_R_Cmd - Fatal编程技术网

从CMD窗口执行R程序

从CMD窗口执行R程序,r,cmd,R,Cmd,我正在尝试从Windows命令行界面运行R程序。我看过以前的帖子,但它不能帮助我同时传递多个参数。其次,我需要在程序中做哪些更改,以便它可以从命令行运行 Statement on CMD look like this; C:\Program Files\R\R-3.3.3\bin\i386> Rscript C:\Users\Public\Command_Line.R "2017-07-04 14:13:25", "2017-07-04 15:36:40", "

我正在尝试从Windows命令行界面运行R程序。我看过以前的帖子,但它不能帮助我同时传递多个参数。其次,我需要在程序中做哪些更改,以便它可以从命令行运行

 Statement on CMD look like this;
      C:\Program Files\R\R-3.3.3\bin\i386> Rscript 
      C:\Users\Public\Command_Line.R "2017-07-04 14:13:25", "2017-07-04 15:36:40", "0000-0000-0000-0000","1","0"
我已经执行了,但它给了我一个错误

 C:\Program Files\R\R-3.3.3\bin\i386> Rscript C:\Users\Public\Command_Line.R   "2017-07-04 14:13:25", "2017-07-04 
  15:36:40", '0000-0000-0000-0000', 1, 0

 Loading required package: methods
 Error in args[1] : object of type 'closure' is not subsettable
 Calls: subset -> subset.data.frame -> eval -> eval
 Execution halted

 Actual program is mentioned below;
 args<-commandArgs(FALSE)
 xsub <- subset(d, d$properties$appuserid ==  args[3]  &
                d$properties$devicedate >= args[1]     &
                d$properties$devicedate <= args[2]     &
                d$properties$location$building == args[4]  &
                d$properties$location$floor == args[5]);
C:\ProgramFiles\R\R-3.3.3\bin\i386>Rscript C:\Users\Public\Command\u Line.R“2017-07-04 14:13:25”、“2017-07-04”
15:36:40", '0000-0000-0000-0000', 1, 0
加载所需包:方法
args[1]中出错:“closure”类型的对象不可子集
调用:subset->subset.data.frame->eval->eval
停止执行
实际方案如下所述;

args命令行参数不能作为
args
自动提供。您需要分配它们,例如使用
args。谢谢您的回复。我已经在R程序中定义了。args没有完整的代码示例,我不能说太多。我想你应该使用
argsI,我在问题中提到了我正在运行的代码。我只想根据CMD上提供的值过滤数据帧。