Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading R using brew on OS X

Tags:

r

I have had this problem once before, and I can’t figure out the best way to fix it.

I am upgrading r from v3.1.2_1 to v3.1.3 to using brew upgrade r. But when I do that I lose all the libraries that I installed under v3.1.2_1. I have to install all the libraries from scratch.

The problem seems to be that brew creates two independent directory structures for two different versions of R under /usr/local/Cellar/r. Is there a way to install R by telling it to use the existing libraries that have been installed?

I could just copy over the files from one version to another, but I am afraid of breaking something.

like image 910
vyom Avatar asked Feb 03 '26 20:02

vyom


1 Answers

You can tell R where to store libraries:

R_LIBS=~/Rlibs

New version of R will look for libraries in this folder. But you will still have to update libraries:

update.packages()

Details are outlined in this post. As a side matter, have a look at the point 2.8 in R FAQ, this one is for Windows but the point is fairly generic. You may be willing to keep old installations the way they are or install new libraries.

like image 84
Konrad Avatar answered Feb 06 '26 09:02

Konrad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!