R-devel in parallel to regular R installation
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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:
export RSOURCES=~/src export RDEVEL=~/R-devel
Then we get the sources with SVN:
mkdir -p $RSOURCES cd $RSOURCES svn co https://svn.r-project.org/R/trunk R-devel R-devel/tools/rsync-recommended
Then, we compile R-devel:
mkdir -p $RDEVEL cd $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:
#!/bin/bash export PATH="$RDEVEL/bin/:$PATH" export R_LIBS=$RDEVEL/library R "$@"
You need to save the script in an executable file somewhere in your $PATH
, e.g. ~/bin
might be a good idea.
Here are commands that make this script automatically in ~/bin/Rdev
:
cat <<EOF>~/bin/Rdev; #!/bin/bash export R_LIBS=$RDEVEL/library export PATH="$RDEVEL/bin/:$PATH" R "$@" EOF 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" )
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
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.