On Thu, 17 May 2007, Leeds, Mark (IED) wrote:
> My sessioninfo is below and I have two questions about loading packages
> in R :
>
> #======================================================================>
============================================================>
> R version 2.4.0 (2006-10-03)
> i686-pc-linux-gnu
>
> locale:
> C
>
> attached base packages:
> [1] "datasets" "methods" "utils"
"stats" "graphics"
> "grDevices" "base"
>
> other attached packages:
> lattice vars strucchange sandwich fBasics
> fCalendar fEcofin zoo chron MASS
> "0.14-9" "0.5-7" "1.3-1"
"2.0-0" "240.10068.1"
> "240.10068" "240.10067" "1.2-2"
"2.3-9" "7.2-29"
>
>
> #======================================================================>
========================================>
>
> 1) The way I download packages is by downloading the necessary .tar.gz
> file into a directory called
>
> /u/etlfs/dev/users/leedsmar/res/R/lib_new
>
> and then do R CMD INSTALL -l . "gz file". Then, in my First.R, if
the
> .gz file was say chron, I have something like
>
> .libPaths("/u/etlfs/dev/users/leedsmar/res/R/lib_new")
>
> print("LOADING CHRON LIBRARY \n")
> library("chron")
>
> This works fine.
>
> So, then I was going to install the lattice package but I noticed that
> if I just type library("lattice") at an R prompt
> Things seem to get loaded correctly. So, my first dumb question is why
> do I go through that whole process of R CMD INSTALL -l . gz file
>
> Maybe this is because, in my. .envfile, my path is set as
>
> PATH=$PATH:/u/leedsmar/bin:/ms/dist/fsf/PROJ/R/2.4.0/lib/R/bin:
>
> so maybe it finds the lattice package over there when you type
> library("whatever") ? But my .libpaths is only set to the lib_new
> directory
> so I'm kind of confused because I thought .libPaths was for poiting to
a
> place where the packages were ?
Yes, and lattice came with R, so it is always in the .libPaths().
.libPaths() will tell you the current value, and note that you can only
add to the default library (or libraries in R >= 2.5.0).
> 2) if there is a reason to still use R CMD INSTALL -l . gz file, then,
> if a package on CRAN says "depends on 2.5.0",
> Is it still okay to go through that R CMD INSTALL -l . process if you
> are using say R.2.4.0 or does the "depends" mean that the package
> will not work.
library() will tell you that you cannot use it.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595