Re: [Rd] NAMESPACE Q: does import as exist?

From: Duncan Murdoch <>
Date: Wed 08 Feb 2006 - 12:10:36 GMT

On 2/7/2006 10:26 PM, Seth Falcon wrote:
> On 7 Feb 2006, wrote:

>>> 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', '')
>> in a NAMESPACE file. Useful-- yes. Possible-- I don't know!

> Yes, this is along the lines of what I was thinking.
> An unpleasant work around would be to create a translation package
> that does something along the lines of Duncan M.'s suggestion,
> importing, renaming, exporting.

Why do you call it unpleasant? With the current mechanisms in R, that's probably what your ImportFromAs function would have to do. There's no way to have two names referring to the same function.

Duncan Murdoch mailing list Received on Wed Feb 08 23:34:40 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:40 GMT