[Rd] about integration of a library into package creation

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 13 14:28:52 CEST 2006


On Tue, 13 Jun 2006, Duncan Murdoch wrote:

[...]

> However, it appears that you can only import packages that have a namespace. 
> (I was unaware of this restriction; perhaps it's not really true, and the 
> error message means something else.)

Yes, it is true but not properly documented.  The description in R-exts is

   All packages implicitly import the base name space.  Variables from
   other packages need to be imported explicitly using the directives
   @code{import} and @code{importFrom}.  The @code{import} directive
   imports all exported variables from the specified package(s).  Thus the
   directives

and that needs to be qualified in at least two ways:

- all packages with namespaces implicitly import the base name space.
- Variables from other packages with a namespace ...

as the concept of `exported variables' only applied to a namespaces.

The terminology is also a little confusing: we have

   importFrom(foo, f, g)

   specifies that the exported variables @code{f} and @code{g} of the
   package @pkg{foo} are to be imported.
   ^^^^^^^
but the error message is of the form

Error in importIntoEnv(impenv, impnames, ns, impvars) :
         object 'print.summary.lm' is not exported by 'namespace:stats'
                                                       ^^^^^^^^^

-- 
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-devel mailing list