p tibco.com
> -Original Message-
> From: peter dalgaard [mailto:pda...@gmail.com]
> Sent: Monday, October 21, 2013 11:56 AM
> To: Duncan Murdoch
> Cc: Bert Gunter; William Dunlap; r-help@r-project.org
> Subject: Re: [R] Recovering object names when using the ... argume
On Oct 19, 2013, at 19:03 , Duncan Murdoch wrote:
> On 13-10-18 1:54 PM, Bert Gunter wrote:
>> Yes, similar, but better, as match.call() will get unwanted named
>> arguments, too.
>>
>> However, I do not understand the
>>
>> substitute(...())
>>
>> idiom. Would you care to explain it? (No is a
On 13-10-18 1:54 PM, Bert Gunter wrote:
Yes, similar, but better, as match.call() will get unwanted named
arguments, too.
However, I do not understand the
substitute(...())
idiom. Would you care to explain it? (No is an acceptable answer!).
I suspect it's a bug, though I can't see it's one
gt; -Original Message-
> From: Bert Gunter [mailto:gunter.ber...@gene.com]
> Sent: Friday, October 18, 2013 10:54 AM
> To: William Dunlap
> Cc: Dan Abner; r-help@r-project.org
> Subject: Re: [R] Recovering object names when using the ... argument in a fn
>
>
>
Yes, similar, but better, as match.call() will get unwanted named
arguments, too.
However, I do not understand the
substitute(...())
idiom. Would you care to explain it? (No is an acceptable answer!).
I would have expressed it as:
as.list(substitute(list(...)))[-1]
to convert the parse tree
Many thanks Bert! You are a big help!!
On Fri, Oct 18, 2013 at 1:25 PM, Bert Gunter wrote:
> That's because I screwed up! I gave you the wrong function, "f" instead of
> "g" .
>
> Here's g:
>
> g <- function(...){
> sapply(as.list(match.call())[-1],deparse)
> }
>
> and the example should now
> I am using the ... argument to parmeterize a user define fn to accept
> multiple input objects. I subsquently save all these data as a list.
> Question: what is the best way to recover or extract the original object
> names that were fed to the fn?
The following function, ellipsisInfo, returns c
That's because I screwed up! I gave you the wrong function, "f" instead of "g" .
Here's g:
g <- function(...){
sapply(as.list(match.call())[-1],deparse)
}
and the example should now work.
Sheepishly,
-Bert
On Fri, Oct 18, 2013 at 10:21 AM, Dan Abner wrote:
> Hi Bert,
>
> Thank you for the
Hi Bert,
Thank you for the code.
However, I don't see what I am doing different, but my output is different.
I would much rather have output similar to yours where only the input
objects are returned (instead of the fn name, the encapsulating
parentheses, etc.):
> d1<-data.frame(x1=runif(100),x
1. Always cc to the list unless it is truly a private offlist reply.
This is to get help from a wider audience, as may well be required
here. Translation: Take my "solution" with a grain of salt. It is
fragile at best.
2. I think ?match.call and ?deparse are what you're looking for:
f <- function
I'm not exactly sure what you mean by "names." Does the following meet
your needs?
f <- function(...)names(list(...))
> f(a=2,b=3)
[1] "a" "b"
> f(a=2,3)
[1] "a" ""
If not, a reproducible example of what you want might be helpful.
Cheers,
Bert
On Fri, Oct 18, 2013 at 9:05 AM, Dan Abner wro
11 matches
Mail list logo