billlee1231
billlee1231

Reputation: 405

CMD Batch file to run R code. How can I choose different version of R?

I have a piece of R code which I want to run periodically. So I use CMD batch file to run it. The command is something like:

R CMD BATCH --vanilla --slave "/mylocalDir/myRcode.r"

I have different version of R installed in my windows. With some version installed some particular package that only works for that version. Thus I need to specify which version of R I need to run in the CMD command. I'm just wondering how I can specify that. Or can I set a default R version?

Thx!

Upvotes: 2

Views: 2958

Answers (1)

Roman Luštrik
Roman Luštrik

Reputation: 70653

I solved running scheduled batch job using the Windows Task Scheduler.

Your latest installed R version is the default. If you want to run the specific version, call it explicitly in your call, e.g.

"C:\Program Files\R\R-2.14.0\bin\x64\R.exe" CMD BATCH --vanilla --slave "windows not linux path :P.R"

Upvotes: 5

Related Questions