user1655408
user1655408

Reputation: 21

R CMD BATCH Choose version of R that is not default

I need to run a job on a cluster using a version of R that is not the default. Usually I use,

R CMD BATCH myfile.R myfileout

but this uses the default version of R. I have the file path for the different version of R that I need to use that is already on the cluster that is something like:

/file/path/R-x.y.z/

How can I run this job using a different version of R?

Upvotes: 2

Views: 581

Answers (2)

V Missirian
V Missirian

Reputation: 11

The above answer didn't work on my university's cluster system, it kept using the newest installed version, even when I was using the full path to the older version.

I was still able to get a script to run (on the command line, at least) by instead running something like this:

/share/apps/R-2.11.0/bin/R --vanilla "--args 1 2 3 herewego" < test.R > test.Rout

Its now using the old version for me (2.11.0), not the new one (3.1.2 I think).

Hope this helps someone who has the same problem :-)

Upvotes: 1

Ben Bolker
Ben Bolker

Reputation: 226951

Just specify the path to the executable, e.g.

/file/path/R-x.y.z/bin/R CMD BATCH myfile.R myfileout

? (You'll need to check the actual location of the R executable ... I think it's typically within the bin directory in the R-x.y.z directory but haven't checked)

Upvotes: 7

Related Questions