Jari Oksanen wrote:
On Wed, 2004-10-27 at 10:04, Uwe Ligges wrote:
Robin Hankin wrote:
Hello list.
I very often need 3d scatterplots, and use scatterplot3D quite a lot.
I am trying to modify persp() to plot scatterplots, and make use of
the theta and phi arguments that persp() offers. I am having some
difficulty passing the correct arguments to persp().
Here is my function so far. Much of it is copied from the persp() manpage.
work as expected, but all extra arguments are passed to persp() _and_
lines() and this gives warnings.
---cut---
QUESTION:
What is best practice to handle this sort of problem? Should I ignore
the warnings() that this approach gives? I can suppress them with
options(warn= -Inf), but is this a good idea? I've read section 10.4
of AITR.
Many of us have thought about this problem.
I'd suggest to introduce frequently used arguments to your meta-function
(such as main, xlab, ylab, ...), but ignore warnings (note: warnings,
not errors) if less frequently arguments are passed through "...".
Alternatively, you can exclude "..." from lines() or points() and
specify a list of arguments to be passed to that call.
This is a larger problem if
1. one of the underlying functions does not have "..."
2. you want to relay arguments to two or more underlying functions, and
3. you don't want to list all possible arguments in your function
definition, since it is long enough already.
The solution is still there, but it is (black) magic. For instance,
'arrows' does not have "...", so you must add them with this magical
mystery string:
formals(arrows) <- c(formals(arrows), alist(... = ))
You don't need it for simple things like:
foo <- function(...){
plot(1:10)
arrows(1,1,7,7,...)
}
foo(lwd=5) # works!
Yes, this is documented in R manuals -- I wouldn't know this otherwise.
Still, it would be nicer if 'arrows' had "..."...
As always, useful patches are welcome.
Uwe Ligges
cheers, jari oksanen
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html