R, RStudio, and release and dev Bioconductor

(This article was first published on Deciphering life: One bit at a time :: R, and kindly contributed to R-bloggers)

R, RStudio, and release and dev Bioconductor

I have one Bioconductor package that I am currently responsible for. Each bi-annual release of Bioconductor requires testing and squashing errors, warnings and bugs in a given package. Doing this means being able to work with multiple versions of R and multiple versions of Bioconductor libraries on a single system (assuming that you do production work and development on the same machine, right?).

I really, really like RStudio as my working R environment, as some of you have read before. So how do we get RStudio on our Linux system to respect which version of R and libraries we want to use?


This assumes that you have your R installs set somewhere properly, and a normal library for production level packages. You should install whichever Bioconductor packages you want into the normal library, and then make a copy of that. This copy will be your development library.

cp -R productionLibrary developmentLibrary

I also assume that you are using a local (i.e. sits in your home directory) .Renviron file to control where R installs the packages.

Changing Versions

RStudio really needs the environment variable RSTUDIO_WHICH_R set to know where R is, and R looks at R_LIBS in the .Renviron file. So I simply create two shell scripts that get sourced.


export RSTUDIO_WHICH_R=/pathToDevR/bin/R
echo "R_LIBS=pathtoDevLibs" > .Renviron

Then I can simply do source useRDev.sh when I need to use the development R and library. Note that you will need to start RStudio from the shell for it to respect this environment variable. RStudio generally seems to install to /usr/lib/rstudio/bin/rstudio.


export RSTUDIO_WHICH_R=/pathtoReleaseR/bin/R
echo "R_LIBS=pathtoReleaseLibs" > .Renviron

This resets my variables by doint source resetR.sh.

Bioconductor Dev Version

To setup Bioconductor to use the develoment version, simply:

source useRDev.sh

# once in RStudio
biocLite(ask=F) # this will update all the installed bioconductor packages

I know this is not the most ideal situation, because I am rewriting over files, but it is working for me, and I thought it might help somone else.

To leave a comment for the author, please follow the link and comment on their blog: Deciphering life: One bit at a time :: R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.