[R-sig-Debian] installing/updating R packages: apt-get vs. install.packages() and .libPaths()

Gregor Gorjanc gregor.gorjanc at gmail.com
Sun Mar 12 03:55:39 CET 2006


Nice explanation Dirk! I agree that a one-pager for R news would be
nice. I am posting the following code, which can warn you about multiple
copies of packages. Using different installation systems has also some
of its drawback. You can easily end up with "several" copies of packages
and you might know which one is loaded after library() is issued - order
is as in .libPaths()

tmp <- table(dir(.libPaths()))
tmp <- tmp[names(tmp) != "R.css"]
test <- sum(tmp > 1)
if (test > 0) {
  cat("\n Warning: you have multiple copies of the following packages:\n")
  print(tmp[tmp > 1])

Lep pozdrav / With regards,
    Gregor Gorjanc

University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.

More information about the R-SIG-Debian mailing list