[Rd] How to change names when importing with a NAMESPACE (was: NAMESPACE Q: does import as exist?)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Feb 8 20:08:04 CET 2006
This is indeed described in
linked from developer.r-project.org.
with the comment
The purpose of baz is to import some of the exports of foo and bar and
re-export them, using renaming in one case: bar's export g is imported
under the internal name hh, and the internal variable hh is exported
under the name gg. [Renaming seems like a useful option, but it may
turn out to create too many complications and need to be dropped.]
It's been there since 1.7.0 and not yet been dropped. (I would also
suggest checking the R-News article on namespaces, which I have not done.
But checking the developer site is always worthwhile.)
It would be nice to have more end-user documentation on namespaces, and I
have suggested it in the past. A project for you, perhaps?
On Wed, 8 Feb 2006, Seth Falcon wrote:
> Well, it seems that the following does what I want. In the NAMESPACE
> file, one can do:
> importFrom("pkgA", foo=bar)
> Which will allow you to use the symbol 'foo' to refer to pkgA::bar.
> This is exactly what I wanted.
> Despite the lack of documentation, this seems an intentional feature.
> Is there a reason not to document it and allow it as part of the
> NAMESPACE feature set?
> + seth
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