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
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
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
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(),
4 matches
Mail list logo