Unfortunately, you need both: R-devel (development version of R) if you want to submit your packages to CRAN, and regular R for your research (you don’t want the unstable release for that).
Fortunately, installing R-devel in parallel is less trouble than one might think.
Say, we want to install R-devel into a directory called ~/R-devel/, and we will download the sources to ~/src/. We will first set up two environment variables to hold these two directories:
Then we get the sources with SVN. In Ubuntu, you need package subversion for that:
mkdir -p $RSOURCES
svn co https://svn.r-project.org/R/trunk R-devel
Then, we compile R-devel. R might complain about missing developer packages with header files, in such a case the necessary package name must be guessed and the package installed (e.g. libcurl4-openssl-dev for Ubuntu when configure is complaining about missing curl):
mkdir -p $RDEVEL
$RSOURCES/R-devel/configure && make -j
That's it. Now we just need to set up a script to launch the development version of R:
You need to save the script in an executable file somewhere in your
~/bin might be a good idea.
Here are commands that make this script automatically in
chmod a+x ~/bin/Rdev
One last thing remaining is to populate the library with packages necessary for the R-devel to run and check the packages, in my case
c("knitr", "devtools", "ellipse", "Rcpp", "extrafont", "RColorBrewer", "beeswarm", "testthat", "XML", "rmarkdown", "roxygen2" ) and others (I keep expanding this list while checking my packages). Also, bioconductor packages limma and org.Hs.eg.db, which I need for a package which I build.
Now I can check my packages with
Rdev CMD build xyz /
Rdev CMD check xyz_xyz.tar.gz