[R] help() and lib.loc (was Re: question about sgeostat)

Albrecht Gebhardt albrecht.gebhardt at uni-klu.ac.at
Tue May 30 10:24:39 CEST 2000


On Tue, 30 May 2000, Prof Brian D Ripley wrote:

> On Tue, 30 May 2000, Albrecht Gebhardt wrote:
> 
> > Now I have stolen
> > 
> > .First.lib <- function(lib, pkg) {
> >   if(version$major==0 && version$minor < 62)
> >     stop("This version for R 0.62 or later")
> >   library.dynam("tripack", pkg, lib)
> >   provide(tripack)
> > }
> > 
> > from library(spatial) and library(tripack,lib.loc="path/to/somewhere")
> > works now.
>  ....
> > 
> > But help() still does not find anything about the library in
> > "path/to/somewhere", even if I pass lib.loc="path/to/somewhere" to help.
> > Is still something wrong with my .First.lib function?
> 
> First.lib is not relevant to help.  Have you loaded the package or not?
yes, loaded.

> Something like
> 
> > help(interp, package="akima", lib.loc="/ext/R/library")
> > help(package="akima", lib.loc="/ext/R/library") 
> 
> works whether it is loaded or not.  The semantics of this got changed
> around 0.99.0 to try to ensure that the help came from loaded libraries.
> So you can do
> 
> library(akima, lib.loc="/ext/R/library")
> ?interp
> help(interp, package="akima")
> 
> and you will get the help from the loaded library even if there is
> a version in the standard library.
> 
> -- 
> 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 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595

Ok, now without loading the library:

...
[Previously saved workspace restored]

> help(tri.mesh)
Error in help(tri.mesh) : No documentation for `tri.mesh'
> help(tri.mesh, package="tripack", lib.loc="~/R-Lib-x86/")
Error in help(tri.mesh, package = "tripack", lib.loc = "~/R-Lib-x86/") : 
        No documentation for `tri.mesh'
> help(tri.mesh, package="tripack", lib.loc="/home/users/agebhard/R-Lib-x86/")
... works

So it seems the lib.loc path contents in library() and help() gets parsed
differently: 

library() knows about the expansion of "~" to the $HOME variable (because
library(tripack,lib.loc="~/R-Lib-x86/") works) but help() does not.


Albrecht


......................................................................
| Albrecht Gebhardt          Tel.: (++43 463) 2700/832               |
| Institut fuer Mathematik   Fax : (++43 463) 2700/834               |
| Universitaet Klagenfurt    mailto:albrecht.gebhardt at uni-klu.ac.at  |
| Villacher Str. 161         http://www-stat.uni-klu.ac.at/~agebhard |
| A-9020 Klagenfurt, Austria                                         |
`--------------------------------------------------------------------'

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list