On 2018-02-20 20:52, William Dunlap wrote:
> Does substitute(...()) do what you want?
That's the key. Thanks very much.
Spencer Graves
>
> > myFunc <- function(x, ...) substitute(...())
> > myFunc(y=1/(1:10), x=sin(3:1), z=stop("Oops"), "untagged arg")
> $y
> 1/(1:10)
>
> $z
>
Does substitute(...()) do what you want?
> myFunc <- function(x, ...) substitute(...())
> myFunc(y=1/(1:10), x=sin(3:1), z=stop("Oops"), "untagged arg")
$y
1/(1:10)
$z
stop("Oops")
[[3]]
[1] "untagged arg"
> names(.Last.value)
[1] "y" "z" ""
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On
Duncan et.al:
Referring to my previous suggestion for f:
> f(log(x),x^2)
[1] "log(x)" "x^2"
Is this not what you want?
Cheers,
Bert
On Tue, Feb 20, 2018 at 4:00 PM, Duncan Murdoch
wrote:
> On 20/02/2018 5:47 PM, Rolf Turner wrote:
>
>> On 21/02/18 11:36, Spencer
If you want to avoid the inefficiency and memory overhead of first
constructing the list and work directly on the language, then I think
?match.call is the tool you want. e.g.
> f <- function(...){
z <- as.list(match.call())[-1]
vapply(z,deparse,"a")
}
> a <- 1
> b <- 2
> f(a,b)
[1]
On 20/02/2018 5:47 PM, Rolf Turner wrote:
On 21/02/18 11:36, Spencer Graves wrote:
Hi, All:
How can I get the names of all the arguments in dots(...)?
I'm able to get the name of the first argument but not the second:
deparseDots <- function(...){
On 21/02/18 11:36, Spencer Graves wrote:
Hi, All:
How can I get the names of all the arguments in dots(...)?
I'm able to get the name of the first argument but not the second:
deparseDots <- function(...){
deparse(substitute(...))
}
a <- 1
b <- 2
deparseDots(a, b)
[1] "a"
Hi, All:
How can I get the names of all the arguments in dots(...)?
I'm able to get the name of the first argument but not the second:
deparseDots <- function(...){
deparse(substitute(...))
}
a <- 1
b <- 2
deparseDots(a, b)
[1] "a"
I'd like to get c('a', 'b').
7 matches
Mail list logo