[R] 2 questions about loading packages

Leeds, Mark (IED) Mark.Leeds at morganstanley.com
Fri May 18 01:19:32 CEST 2007


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 ?

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.


Thanks for your patience and any insights. I'm obviously not
understanding things very well and would like to change this as 
much as I can.
--------------------------------------------------------

This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}



More information about the R-help mailing list