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
roblem=stop("there was a
>>>> problem"))
>>>> i
>>>
>>> "x"
>>>
>>> "log(10)"
>>> e
>>> "exp(
Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of Dan Abner
Sent: Friday, October 18, 2013 9:06 AM
To: r-help@r-project.org
Subject: [R] Recovering object names when using the ... argument in a fn
Hi all,
I am using the ... argument to parmeterize a
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
>
>
>
> itself
> [1] "x" "log(10)" "e"
> [4] "onProblem"
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-p
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
[mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Dan Abner
> Sent: Friday, October 18, 2013 9:06 AM
> To: r-help@r-project.org
> Subject: [R] Recovering object names when using the ... argument in a fn
>
> Hi all,
>
> I am using the ... argument to parmeter
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
Hi all,
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?
Thanks,
Dan
[[alternative HTML versi
12 matches
Mail list logo