Re: [Rd] as.name and namespaces

2013-04-24 Thread Patrick Burns
Here is an example problem: mycall - expression(lm(Y ~ x))[[1]] mycall lm(Y ~ x) newname - stats::lm desiredResult stats::lm(Y ~ x) I've solved the problem in the kludgy way of deparsing, fixing the string and then parsing. I like Duncan's third method, but it seems like it assumes the

Re: [Rd] as.name and namespaces

2013-04-24 Thread peter dalgaard
There's also the brute force option: mycall - expression(lm(Y ~ x))[[1]] mycall[[1]] - quote(stats::lm) mycall stats::lm(Y ~ x) eval(mycall, list(Y=rnorm(5),x=1:5)) Call: stats::lm(formula = Y ~ x) Coefficients: (Intercept)x 0.07430 0.02981 On Apr 24, 2013, at

Re: [Rd] as.name and namespaces

2013-04-24 Thread William Dunlap
: Re: [Rd] as.name and namespaces Here is an example problem: mycall - expression(lm(Y ~ x))[[1]] mycall lm(Y ~ x) newname - stats::lm desiredResult stats::lm(Y ~ x) I've solved the problem in the kludgy way of deparsing, fixing the string and then parsing. I like Duncan's

[Rd] as.name and namespaces

2013-04-23 Thread Patrick Burns
'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? Pat -- Patrick Burns pbu...@pburns.seanet.com twitter: @burnsstat @portfolioprobe

Re: [Rd] as.name and namespaces

2013-04-23 Thread peter dalgaard
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 :::

Re: [Rd] as.name and namespaces

2013-04-23 Thread Patrick Burns
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. 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

Re: [Rd] as.name and namespaces

2013-04-23 Thread peter dalgaard
On Apr 23, 2013, at 21:51 , 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. Offhand, I'd say that it shouldn't be a problem, but do you have a more concrete

Re: [Rd] as.name and namespaces

2013-04-23 Thread Duncan Murdoch
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.