[R-sig-Debian] Can I install debs over packages installed via R?

Dirk Eddelbuettel edd at debian.org
Sat Jan 30 18:26:26 CET 2010


[ Kevin sent this to me but agreed that it's better to have this discussed here. ]

On 30 January 2010 at 12:18, Kevin Donnelly wrote:
| Hi
| 
| I'm beginning to learn R,a nd I've just discovered cran2deb - what a terrific 
| resource!  Thanks for making it.
| 
| I was wondering what happens if I want to use cran2deb versions instead of the 
| versions installed via R itself.  I'm on Ubuntu 9.10, and the package 
| versions go into /usr/lib/R/library, while the R versions go 
| into /usr/local/lib/R/site-library.  Is it OK just to delete them from the 
| site-library, and reinstall from cran2deb?

1)  These are different locations, so there is no conflict.

2)  R looks at the variables R_LIBS (or rather, R_LIBS_SITE and
    R_LIBS_USER). On Debian/Ubuntu, R_LIBS is set in /etc/R/Renviron to 

  # edd Apr 2003  Allow local install in /usr/local, also add a directory for
  #               Debian packaged CRAN packages, and finally the default dir 
  # edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
  R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'}

3)  This means

      /usr/local/lib/R/site-library     is first and hence the default, so
      					both 'R CMD INSTALL foo_1.2-3.tar.gz'
      					and install.packages("foo") install here.
					This is where R puts things.

      /usr/lib/R/site-library		is where most r-cran-* packages go

      /usr/lib/R/library		is where base and recommended r-cran-* 
      					packages (ie those shipped with R sources)
					go

4)  You have no conflict, but if you have a library 'foo' in several
    directories, the first one found wins.

5)  On Debian, and thanks to cran2deb, I personally keep almost everything in 
    /usr/lib/R/site-library as I use cran2deb _a lot_. /usr/local is only for
    unpackage code, or things I install directly from SVN, or ...

6)  On Ubuntu, I tend to rely on install.packages() and R CMD INSTALL and the
    packages go into /usr/local/lib/R/site-library.  I do not use cran2deb on
    Ubuntu. 

Other folks may have other recommendations. Liviu seems to live happly with
cran2deb on Ubuntu. You can try it but ... buy beware.

Hope this helps, Dirk

-- 
Three out of two people have difficulties with fractions.



More information about the R-SIG-Debian mailing list