[R] library in R2.0.0

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Oct 7 09:28:40 CEST 2004


On Thu, 7 Oct 2004, Petr Pikal wrote:

> Hi all
> 
> I upgraded to 2.0.0 version and did everything as I used to do 
> before.
> 
> I installed windows binary, copy/paste other than bundled 
> packages. 
> 
> I got e.g.
> > library(chron)
> Error in library(chron) : 'chron' is not a valid package -- installed < 
> 2.0.0?
> 
> so I loaded it from CRAN and everything worked OK except my 
> own personal functions (they are not on CRAN). So I went 
> through NEWS file which says:
> 
> o	Packages must have been re-installed for this version, and
> 	library() will enforce this.
> 
> I have never done it, my simple set of functions was never actually 
> installed. I used copy/paste the directory from old R version to 
> new one and I used library(fun) in personal .Rprofile to load my 
> function set. Doing that again I got:
> 
> Error in library(fun) : There is no package called 'fun'
> 
> I know I can use source
> source("D:/programy/R/rw2000/library/fun/R/fun")
> but I feel library way is better way and I think I could try it.
> 
> Before I start to try transferring my function set to a real package I 
> would like to ask simple ***question***.
> 
> Is the error message result of not installing package fun correctly 
> (at all) or I shall do something more than follow instructions in 
> README.packages and other documentation?

I believe that message comes from your self-built package not having a 
DESCRIPTION file.  

Installing a package checks it has the features needed (such as a 
DESCRIPTION file) and then creates a lot of metadata (indices, parsed 
NAMESPACE and DESCRIPTION files and so on) that R assumes will be present 
when a package is loaded.  So as of 2.0.0 you do need to use R CMD INSTALL 
to create a usable package.

-- 
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




More information about the R-help mailing list