From ripley at stats.ox.ac.uk  Mon Aug  4 12:05:39 2003
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon Aug  4 12:05:24 2003
Subject: [Rd] namespace magic
In-Reply-To: <Pine.SOL.4.30.0307311113170.9985-100000@ysidro.econ.uiuc.edu>
Message-ID: <Pine.LNX.4.44.0308041101490.13617-100000@gannet.stats>

On Thu, 31 Jul 2003, Roger Koenker wrote:

> I'm confused about name spaces.  This morning I installed the
> boot package because I wanted to look at bca.ci.  So I did
> library(boot), but then I had,
> 
> > bca.ci
> Error: Object "bca.ci" not found
> 
> I had a look in the boot R directory and bca.ci was there as expected.
> So then I took a look at the NAMESPACE file for the boot package and saw
> that bca.ci wasn't exported.  I tried
> 
> example(boot.ci)
> 
> and this worked fine including computing the bca.ci version of some
> intervals.  Finally, I read the section on name spaces in Writing R
> extensions, which was very helpful but still didn't answer my basic
> question:  how is it that bca.ci is not loaded and still available
> to do the example?  And why not export bca.ci and friends?

The answer to the last question is because they are internal functions for 
the boot package.  They are available to functions in the boot package, 
and to functions in any other package with a namespace that imports them.

You can look at non-exported functions by

getFromNamespace("bca.ci", "boot")  # without even library(boot)
getAnywhere("bca.ci")

and in R-devel

boot:::bca.ci



-- 
Brian D. Ripley,                  ripley@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


[Rd] namespace magic
Prof Brian Ripley