Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run the development version of R along side the stable version

Tags:

r

ubuntu

I want to check a R package with R-devel under Ubuntu.

I installed R-devel based on http://www.personal.psu.edu/mar36/blogs/the_ubuntu_r_blog/2012/08/installing-the-development-version-of-r-on-ubuntu-alongside-the-current-version-of-r.html

and I found the guide for Mac OS. http://www.nicebread.de/how-to-check-your-package-with-r-devel/

I tried R CMD check pkg --as-cran, but it's still the stable R version to be used to check. How to let the R-devel be used to check?

Thanks in advance!

like image 323
Randel Avatar asked Mar 28 '13 05:03

Randel


2 Answers

Probably you have omitted the final step mentioned in the blog post you linked to. You need to change a number of environment variables to point to the new, development version of R. The post suggests creating a script to run the development version of R:

#!/bin/bash
# This assmues the dev version of R is installed in /usr/local/

export R_LIBS_SITE=${R_LIBS_SITE-'/usr/lib/R-devel/lib/R/library:/usr/local/lib/R/site-library:/usr/lib/R/site-library::/usr/lib/R/library'}
export PATH="/usr/local/lib/R-devel/bin:$PATH"
R "$@"

You can save this in a location in your $PATH, and name it for example R-devel. Make sure to make the script executable with chmod. Then you can launch R-devel like this:

R-devel CMD check pkg --as-cran
like image 95
Paul Hiemstra Avatar answered Sep 19 '22 00:09

Paul Hiemstra


I have an alternative method based on advice from the bioc-devel mailing list. Assuming you want to install r-devel in your home directory, say in ~/R-devel/, here is what you do:

First, set up environmental variables so that we don't need to repeat the names of directories. A directory for the sources and a directory for the compiled distro. Of course, they could be anywhere, wherever you like them to be:

export RSOURCES=~/src
export RDEVEL=~/R-devel

Now, get the sources + recommended packages:

mkdir -p $RSOURCES
cd $RSOURCES
svn co https://svn.r-project.org/R/trunk R-devel
R-devel/tools/rsync-recommended

Next, build the R and packages:

mkdir -p $RDEVEL
cd $RDEVEL
$RSOURCES/R-devel/configure && make -j

That's it, you're done. Just save the following in an executable script somewhere to be able to run the development version:

#!/bin/bash
export R_LIBS=~/R-devel/library
R "$@"

Here is a script that saves the script automatically to your ~/bin/ directory:

cat <<EOF>~/bin/Rdev;
#!/bin/bash

export R_LIBS=$RDEVEL/library
export PATH="$RDEVEL/bin/:\$PATH"
R "\$@"
EOF
chmod a+x ~/bin/Rdev

Now you can simply run Rdev as if you were running R, and you will have the development version of R, which will install packages in $RDEVEL/library.

like image 44
January Avatar answered Sep 22 '22 00:09

January