R, RStudio, and Release and Dev Bioconductor

Working with the development version of Bioconductor on linux can be a pain. This is one way to do it.

R
bioconductor
rstudio
programming
packages
development
Author

Robert M Flight

Published

September 17, 2013

Update 2021-02-18: Now I would just use the r-docker image and the RStudio interface. I actually just did this recently to test updates to my package.

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?

Setup

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.

useRDev.sh

#!/bin/sh
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.

resetR.sh

#!/bin/sh
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
rstudio

# once in RStudio
library(BiocInstaller)
useDev()
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.

Reuse

Citation

BibTeX citation:
@online{mflight2013,
  author = {Robert M Flight},
  title = {R, {RStudio,} and {Release} and {Dev} {Bioconductor}},
  date = {2013-09-17},
  url = {https://rmflight.github.io/posts/2013-09-17-r-rstudio-and-release-and-dev-bioconductor},
  langid = {en}
}
For attribution, please cite this work as:
Robert M Flight. 2013. “R, RStudio, and Release and Dev Bioconductor.” September 17, 2013. https://rmflight.github.io/posts/2013-09-17-r-rstudio-and-release-and-dev-bioconductor.