[R] "..." and Error: unused argument(s)

About this list Date view Thread view Subject view Author view Attachment view

From: Jari Oksanen (jarioksa@sun3.oulu.fi)
Date: Thu 03 Apr 2003 - 00:22:58 EST


Message-id: <1049293378.9460.59.camel@pc112145.oulu.fi>

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@sun3.oulu.fi>

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:38 EST