Using system R with user installed packages
In my previous posts here and here, I showed you how to maintain your own R install, and update the libraries after you update your own R version.
Today, I’m going to cover an easier topic, how to use the system R installs.
We have a variety of versions of R on the infrastructure. By default, you are
most likely to use the system version of R that comes with CentOS 7, which is
found in /usr/bin/R
and /bin/R
, which happens to be 3.3.1 and is from 2016.
Let’s take a look at what’s available that we have installed for you:
|
|
To get the latest version of R accessible to you, we’ll need to edit your
.cshrc
or .bashrc
depending on which shell you are using.
Here are the commands to do so:
|
|
You can log out and log back in, or source
the appropriate file to make sure
the changes have taken place:
|
|
You can maintain your packages in your lab space the same way as I previously covered in the first post.
You might simplify the path a bit, and you can decide if you want to maintain a record of packages for each R install, e.g.
|
|
Then, you can iterate directories when new verisons come out, e.g. if 4.0.3 is the next version:
|
|
OR, for a more simple library variable:
|
|
You need to add the export or setenv commands, for bash and tcsh into your .bashrc or .cshrc files, respectively, for the commands to remain after login/logout.
Load up an R session and test out the new $R_LIBS
environment variable that
you set:
|
|
You’ll see that I went with the second option. I generally copy a backup of the library dir to a backup folder on big version jumps, just in case some error really slows down my work, I have something to fall back to. But, otherwise, having a single folder for R libraries has not caused me too much trouble.
Whatever way you maintain your R, be it through the /local/cluster/R-
versions
or your own, you should be covered.
Feel free to request R version upgrades if we don’t get to them soon enough using the relatively new cgrb-software request form. Help us out by choosing cgrb-software from the dropdown menu.
Thanks, and good luck!