Tariq,
See inline for my reply.
Le mar. 15 juil. à 21:48, Tariq Perwez a écrit :
Hi Everyone,
I have a few fairly basic questions about upgrading and installing R
packages. First off, I am using Ubuntu Hardy Heron and have R 2.7.1
installed and working perfectly. I usually access R via Emacs ESS
interface
which I am still trying to get the hang of. My questions and issues
are as
follows:
Question 1: I started R and wanted to upgrade the installed R
packages. So,
I issue the command >upgrade.packages()
and after selecting the CRAN mirror sites, I get the following
message:
lattice :
Version 0.17-8 installed in /usr/lib/R/library
Version 0.17-10 available at http://www.ibiblio.org/pub/languages/R/CRAN
Update (y/N/c)?
(To this, I respond with "y", but then I get the following:)
Warning in install.packages(update[instlib == l, "Package"], l,
contriburl =
contriburl, :
'lib = "/usr/lib/R/library"' is not writable
(Off course, it is NOT writable because it did not ask for the
administrative password.
Would you like to create a personal library
'~/R/i486-pc-linux-gnu-library/2.7'
to install packages into? (y/n)
I do not want to create new directories; I just want to upgrade
where the
older version already exists. So I respond with "n" and get this:)
Error in install.packages(update[instlib == l, "Package"], l,
contriburl =
contriburl, :
unable to install packages
My question is how do I go about upgrading AND installing packages
from
within R by using administrative account? I must say that at least
for now,
I was able to get around this issue by staring R as:
sudo R
and then using upgrade.packages(). But I would like a better
solution when I
am already in an R session.
I don't think there's a way. But here, on an Ubuntu/Debian derived
system and for the base and recommended packages at least, I would
really recommended you administer the R packages through the system
packaging system. The aforementioned packages are kept up-to-date on
CRAN, so a simple
sudo apt-get update
sudo apt-get dist-upgrade
will get you the latest version without a fuss. Please check the
Ubuntu README on CRAN:
http://cran.r-project.org/bin/linux/ubuntu/
Question 2: When I started R via
sudo R
and issued >upgrade.packages()
I had problem upgrading lattice package. I got the following error
message:
* Installing *source* package 'lattice' ...
** libs
gcc -std=gnu99 -I/usr/share/R/include -fpic -g -O2 -c init.c -
o init.o
In file included from init.c:2:
/usr/share/R/include/R.h:28:20: error: stdlib.h: No such file or
directory
/usr/share/R/include/R.h:29:19: error: stdio.h: No such file or
directory
In file included from
/usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h:7,
from /usr/lib/gcc/i486-linux-gnu/4.2.3/include/
limits.h:11,
from /usr/share/R/include/R.h:30,
from init.c:2:
/usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h:122:61: error:
limits.h:
No such file or directory
In file included from init.c:2:
/usr/share/R/include/R.h:32:18: error: math.h: No such file or
directory
/usr/share/R/include/R.h:33:19: error: errno.h: No such file or
directory
In file included from /usr/share/R/include/R.h:50,
from init.c:2:
/usr/share/R/include/R_ext/RS.h:24:39: error: string.h: No such file
or
directory
In file included from init.c:3:
/usr/share/R/include/Rinternals.h:770: error: expected declaration
specifiers or '...' before 'FILE'
/usr/share/R/include/Rinternals.h:773: error: expected declaration
specifiers or '...' before 'FILE'
make: *** [init.o] Error 1
ERROR: compilation failed for package 'lattice'
** Removing '/usr/lib/R/library/lattice'
** Restoring previous '/usr/lib/R/library/lattice'
The downloaded packages are in
/tmp/Rtmpj37zYN/downloaded_packages
Updating HTML index of packages in '.Library'
Warning message:
In install.packages(update[instlib == l, "Package"], l, contriburl =
contriburl, :
installation of package 'lattice' had non-zero exit status
Even >upgrade.packages(dependencies = TRUE) resulted in the same
error. Does
anyone know if this is just a problem on my system or perhaps
someone else
has run into the same issue. What does this all mean? What I do not
understand is why are there .h missing files? How the heck did
lattice get
installed in the first place if these header files were missing?
Install the r-base-dev package. Again, this is discussed in the README
(and in this forum a couple of days ago):
Users who need to compile packages should also install the r-base-dev
package:
sudo apt-get install r-base-dev
Question 3: This is more of a general question that has been on my
mind for
sometime. If I just want to install some packages/data base etc that
I would
like to be "local", perhaps in my home directory, which library path
would
be recommended? Sometimes I feel that I would like to download some
database
or other packaged code that I want to play around with but would
later like
to get rid of, a library in the home directory that is still in R's
path
might be better. I would appreciate suggestions. What are others
doing in
this situation? Currently I have the following outcome of .libPaths()
command:
.libPaths()
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"
[3] "/usr/lib/R/library"
Which library path should I choose?
Whatever you wish (my personal pick below). This is also discussed in
the README:
Individual users can install R packages into their home directory.
The simplest procedure is to create a file ~/.Renviron containing,
e.g.,
R_LIBS="~/lib/R/library:${R_LIBS}"
The install.packages() and update.packages() functions will then work
in directory ~/lib/R/library.
HTH
---
Vincent Goulet, Associate Professor
École d'actuariat
Université Laval, Québec
[EMAIL PROTECTED] http://vgoulet.act.ulaval.ca
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.