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, 2019 in Data Analytics by Tyrion anex
• 8,700 points
867 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, 2019 by Sophie may
• 10,610 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 Sahiti
• 6,370 points
3,541 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 6, 2019 in Data Analytics by anonymous
13,685 views
+1 vote
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 14, 2018 in Data Analytics by Sahiti
• 6,370 points
6,344 views
+10 votes
3 answers

Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

answered Aug 9, 2018 in Data Analytics by Abhi
• 3,720 points
1,162 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,840 points
483 views
0 votes
1 answer
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, 2019 in Data Analytics by Sophie may
• 10,610 points
502 views
+1 vote
1 answer

How to calculate relative risk in R language?

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

answered Feb 20, 2019 in Data Analytics by Sophie may
• 10,610 points
2,064 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP