Re: [R] An argument processing puzzle --- solution.

2010-01-18 Thread Duncan Murdoch
On 18/01/2010 7:51 PM, Rolf Turner wrote: Thanks to Berton Gunter and Peter Ehlers who both effectively solved my problem. Prof. Gunter's solution, slightly more succinct, is: foo <- function(x) { if(is.name(sb <- substitute(x))) deparse(sb) else eval(sb) } (appropriately modified to fi

Re: [R] An argument processing puzzle --- solution.

2010-01-18 Thread Rolf Turner
Thanks to Berton Gunter and Peter Ehlers who both effectively solved my problem. Prof. Gunter's solution, slightly more succinct, is: foo <- function(x) { if(is.name(sb <- substitute(x))) deparse(sb) else eval(sb) } (appropriately modified to fit into the ``mv()'' context. Duncan Murdoch

Re: [R] An argument processing puzzle.

2010-01-18 Thread Peter Ehlers
Rolf Turner wrote: I have been trying to write a function mv(a,b) to move an object a to object b. It returns no value, but only exists for this side effect. Basically it just does b <- a; rm(a). With some checking and prompting about over-writing. The thing is, I'd like to be able to use ei

Re: [R] An argument processing puzzle.

2010-01-18 Thread Duncan Murdoch
On 18/01/2010 3:22 PM, Rolf Turner wrote: I have been trying to write a function mv(a,b) to move an object a to object b. It returns no value, but only exists for this side effect. Basically it just does b <- a; rm(a). With some checking and prompting about over-writing. The thing is, I'd lik

[R] An argument processing puzzle.

2010-01-18 Thread Rolf Turner
I have been trying to write a function mv(a,b) to move an object a to object b. It returns no value, but only exists for this side effect. Basically it just does b <- a; rm(a). With some checking and prompting about over-writing. The thing is, I'd like to be able to use either call by name or