MikeJewski
MikeJewski

Reputation: 357

Specifiy version of R to run when running a script from bash

I am trying to run an R script from a bash script using the Rscript command. The cluster I am on has multiple versions of R, and is telling me: "Error: This is R version 2.15.1. Package 'raster' requires >= 3.0.0. Is there a way to specify the version of R to run Rscript with?

#!/bin/sh
Rscript Test.R

Upvotes: 0

Views: 1186

Answers (1)

SaintHax
SaintHax

Reputation: 1943

If you don't use a full path, then it will run the version that is found first in your $PATH variable. The solution is to either have your path have the R directory at the beginning, or to the correct path (e.g. 'alias R=/opt/my/path/R') and run the script with `shopt -s expand_aliases'

Upvotes: 3

Related Questions