I am struggling with how to link/sync the version of R that I access from the bash terminal on Mac OSX to the version of R (and R libraries) that I have in R Studio.
Some background:
I installed R/R studio by downloading the most recent versions available from the developer's websites as of 10/9/2016.
I previously had R installed on bash, but that version was 3.2.5 not 3.3.1 that I downloaded online. So if I tried to open an R script from bash, it would launch a deprecated version of RStudio that crashed.
To fix this, I used Brew to unlink the old version of R, and reinstall R in bash.
brew unlink r
brew install R
The Problems:
Now when I launch an R script from terminal, it opens the correct version of RStudio, which has a version:
version.string R version 3.3.1 (2016-06-21)
nickname Bug in Your Hair
However, if in bash I simply launch R using $ R
, I have version:
R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Furthermore, the packages installed in RStudio are not linked. In Rstudio I can load a package library such as library(tidyverse)
without error.
In bash's $ R
, the above command library(tidyverse)
throws an error:
Error in library(tidyverse) : there is no package called ‘tidyverse’
What I would like is a way to link the bash version of R and Rstudio such that the R-versions are the same and such that packages installed in R are recognized in RStudio, and RStudio installed packages can load in bash R.
Thanks for your help.