From Mark.Bravington at csiro.au  Wed Feb  8 04:14:15 2006
From: Mark.Bravington at csiro.au (Mark.Bravington@csiro.au)
Date: Wed, 8 Feb 2006 14:14:15 +1100
Subject: [Rd] NAMESPACE Q: does import as exist?
Message-ID: <D79013E40FEF254AAF0D72DFC94F274816B00B@extas4-hba.tas.csiro.au>

> On 2/7/2006 8:48 PM, Seth Falcon wrote:
> > Is there a way to rename a function when importing it?  I 
> want to say, 
> > "import yourFunc from Foo as myFunc" in the NAMESPACE file.
> 

I don't think Seth's facility exists yet, but it has occurred to me
previously that it would be useful when you need to import two different
functions with the same name from two different packages. (Rare but does
happen.) Duncan's solution won't get around that. So it would be nice to
be able to do this

ImportFromAs( 'pack1', 'funca', 'pack1.funca')
ImportFromAs( 'pack2', 'funca', 'different.name.altogether')

in a NAMESPACE file. Useful-- yes. Possible-- I don't know!

Mark Bravington
CSIRO Mathematical & Information Sciences
Marine Laboratory
Castray Esplanade
Hobart 7001
TAS

ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623
 

> -----Original Message-----
> From: r-devel-bounces at r-project.org 
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Duncan Murdoch
> Sent: Wednesday, 8 February 2006 1:11 PM
> To: Seth Falcon
> Cc: r-devel at stat.math.ethz.ch
> Subject: Re: [Rd] NAMESPACE Q: does import as exist?
> 
> On 2/7/2006 8:48 PM, Seth Falcon wrote:
> > Is there a way to rename a function when importing it?  I 
> want to say, 
> > "import yourFunc from Foo as myFunc" in the NAMESPACE file.
> > 
> > Does this exist and I've missed it?  If it doesn't exist, 
> would others 
> > think it useful (and possible)?
> 
> I don't know if that exists, but importing it and then 
> copying it should work.  That is, in your namespace import 
> foo, and export bar, and in one of your R source files have
> 
> bar <- foo
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
>



[Rd] NAMESPACE Q: does import as exist?
Mark.Bravington@csiro.au