Using CMD Windows to execute R language

0 votes

I am using the Windows command line interface to run my R program.  For some reason I'm unable to pass multiple arguments at a same time. This is what I'm trying to execute:

 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"

I get the following error on execution:

 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]);
Jan 14 in Data Analytics by Tyrion anex
• 8,270 points
62 views

1 answer to this question.

0 votes

So, Command line arguments can't be directly used as args. You must assign them e.g. 

args <- commandArgs()

Whereas you are trying to subset the function args() which will result in an error

answered Jan 14 by Sophie may
• 9,530 points

Related Questions In Data Analytics

0 votes
1 answer

How to change y axis max in time series using R?

The axis limits are being set using ...READ MORE

answered Apr 3, 2018 in Data Analytics by darklord
• 6,140 points
104 views
0 votes
1 answer
0 votes
2 answers

How to use group by for multiple columns in dplyr, using string vector input in R?

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 5 in Data Analytics by anonymous
2,864 views
0 votes
1 answer

How to convert a list of dataframes in to a single dataframe using R?

You can use the plyr function: data <- ...READ MORE

answered Apr 13, 2018 in Data Analytics by darklord
• 6,140 points
142 views
+1 vote
2 answers
0 votes
1 answer

R programming logic

Use gsub to match the substring that we want ...READ MORE

answered Nov 16, 2018 in Data Analytics by Maverick
• 10,040 points
28 views
0 votes
1 answer
+4 votes
2 answers
0 votes
1 answer

Is it possible to link the R language and Julia?

R has a specific package just for ...READ MORE

answered Jan 21 in Data Analytics by Sophie may
• 9,530 points
48 views
0 votes
1 answer

How to calculate relative risk in R language?

The risk can be calculated by using ...READ MORE

answered Feb 20 in Data Analytics by Sophie may
• 9,530 points
61 views