[R] getAnyhwhere behavior

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jul 17 22:39:53 CEST 2003


On Fri, 11 Jul 2003, Cliff Lunneborg wrote:

> I would have expected the function getAnywhere to have behaved
> differently in the following:
> 
> > search()
>  [1] ".GlobalEnv"                  "file:C:/R/Rdata/miya/.Rdata"
>  [3] "package:boot"                "package:methods"
>  [5] "package:ctest"               "package:mva"
>  [7] "package:modreg"              "package:nls"
>  [9] "package:ts"                  "Autoloads"
> [11] "package:base"
> 
> > getAnywhere(basic.ci)
> Error in getAnywhere(basic.ci) : Object "basic.ci" not found
> 
> > basic.ci<-get("basic.ci",environment(boot))
> 
> > getAnywhere(basic.ci)
> A single object matching `basic.ci' was found
> It was found in the following places
>   .GlobalEnv
>   registered S3 method for basic from namespace boot
>   namespace:boot
> with value
> 
> function (t0, t, conf = 0.95, hinv = function(t) t)
> {
>     qq <- norm.inter(t, (1 + c(conf, -conf))/2)
>     out <- cbind(conf, matrix(qq[, 1], ncol = 2), matrix(hinv(2 *
>         t0 - qq[, 2]), ncol = 2))
>     out
> }
> <environment: namespace:boot>
> 
> Why did getAnywhere not "see" basic.ci in the environment from which I
> "got" it?

Try reading the help page: your first usage is incorrect, and you get an
error message, as your should.  You seem to be blind to one of the
differences in your two calls.

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