Re: [R] The evaluation of optional function arguments

2008-10-20 Thread Sietse Brouwer
Hullo all, [***recap of the question: passing bar=harry fails when bar is among the ... args.] callTimes - function(tom, harry) { timesDefineInside(foo=tom, bar=harry } timesDefineInside - function(foo, ...) { foo * bar } callTimes(3, 4) # Error: object bar not found [***end

[R] The evaluation of optional function arguments

2008-10-19 Thread Sietse Brouwer
Dear R-helpers, I've got two functions; callTimes() calls times(), passing it an optional argument (bar) by name (bar=harry). times() then believes it has been passed a name, rather than a value — but I want the value, not the name. Worse, if I evaluate the name, it is evaluated in the

Re: [R] The evaluation of optional function arguments

2008-10-19 Thread Kaom Te
Try this for timesDefineInside: timesDefineInside - function(foo, ...) { extra.args - list(...) bar - extra.args$bar foo * bar } -Kaom On Oct 19, 2008, at 6:34 PM, Sietse Brouwer wrote: Dear R-helpers, I've got two functions; callTimes() calls times(), passing it an optional

Re: [R] The evaluation of optional function arguments

2008-10-19 Thread hadley wickham
Why don't you want to do this? timesDefineInside - function(foo, bar...) { foo * bar } It seems like the obvious solution to your problem. Hadley On Sun, Oct 19, 2008 at 8:34 PM, Sietse Brouwer [EMAIL PROTECTED] wrote: Dear R-helpers, I've got two functions; callTimes() calls times(),