[R] ... and parameter checking

Jens Oehlschlägel-Akiyoshi jens.oehlschlaegel-akiyoshi at mdfactory.de
Fri Dec 17 15:33:02 CET 1999



Hi,

when writing a wrapper function, I would like to be able to pass additional
arguments to more than one function inside, e.g.

  density.panel <- function(x, na.rm=TRUE, ...){
     usr <- par("usr")
     on.exit(par(usr))
     par(usr = c(usr[1:2], 0, 1) )
     lines( density(x, na.rm=na.rm, ...), ... )
  }

and then call it like

  density.panel(x, col="red",  kernel="rectangular")


However, doing so generates an error from density (col=), which does not
allow ... and a warnings from plot.default(), which does not know about
kernel= .

Obviously I could patch density() to have a ... parameter and ignore
warnings from plot(), but, well ...

Can someone teach me how to solve this properly?

I cannot remember to have had such problems with S+, is this a difference
between R and S+ ?

Regards


--
Dr. Jens Oehlschlägel-Akiyoshi
MD FACTORY GmbH
Bayerstrasse 21

80335 München

Tel.: 089 545 28-27
Fax.: 089 545 28-10
http://www.mdfactory.de

Standard Disclaimers: Opinions expressed here are personal
and are not otherwise represented.


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list