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,280 points
44 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,050 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
42 views
0 votes
1 answer
0 votes
1 answer

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

dplyr added versions for group_by. This allows you ...READ MORE

answered Apr 12, 2018 in Data Analytics by CodingByHeart77
• 3,680 points

edited Apr 12, 2018 by CodingByHeart77 1,664 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
61 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,000 points
13 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,050 points
38 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,050 points
11 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.