[Rd] as.name and namespaces
Duncan Murdoch
murdoch.duncan at gmail.com
Tue Apr 23 22:18:28 CEST 2013
On 13-04-23 3:51 PM, Patrick Burns wrote:
> Okay, that's a good reason why it shouldn't.
>
> Why it should is that I want to substitute
> the first element of a call to be a function
> including the namespace.
Three ways:
1. Assign the function from the namespace locally, then call the local one.
2. Import the function in your NAMESPACE (if you know the name in advance).
3. Construct an expression involving ::, and substitute that in.
For example:
substitute(foo(x), list(foo=quote(baz::bar)))
Duncan Murdoch
>
> Pat
>
>
> On 23/04/2013 18:32, peter dalgaard wrote:
>>
>> On Apr 23, 2013, at 19:23 , Patrick Burns wrote:
>>
>>> 'as.name' doesn't recognize a name with
>>> its namespace extension as a name:
>>>
>>>> as.name("lm")
>>> lm
>>>> as.name("stats::lm")
>>> `stats::lm`
>>>> as.name("stats:::lm")
>>> `stats:::lm`
>>>
>>>
>>> Is there a reason why it shouldn't?
>>
>> Any reason why it should? :: and ::: are operators. foo$bar is not the same as `foo$bar` either.
>>
>
More information about the R-devel
mailing list