[R] "..." and Error: unused argument(s)
Jari Oksanen
jarioksa at sun3.oulu.fi
Wed Apr 2 16:22:58 CEST 2003
Dear R people,
Would it be possible to add "..." to the argument list of arrows() or
should this be dealt with at the user level?
The problem is that I need arrows() in a function together with points()
or text(). All these are used with their default values, but I let the
user to change these so that there is "..." in my function call. Some of
these parameters (like col) are meaningfully transferred to both
arrows() and points()/text(), but other makes sense only in one. This
results sometimes in a warning in points() and text(), but this can be
tolerated. Function arrows() doesn't tolerate any strange parameters,
but gives an error, stops, and doesn't draw anything:
Error in arrows(0, 0, pts[, 1], pts[, 2], length = head.arrow, ...) :
unused argument(s) (cex ...)
Instead of dying from unused arguments, I would like arrows() to
silently ignore them.
Now I solved this problem with a hack (or is that a kludge?) of adding
this line in my function:
formals(arrows) <- c(formals(arrows), alist(... = ))
Is this the recommended way to go?
cheers, jari oksanen
--
Jari Oksanen <jarioksa at sun3.oulu.fi>
More information about the R-help
mailing list