[R] passing arguments via "..."

From: Cable, Samuel B Civ USAF AFMC AFRL/RVBXI <Samuel.Cable_at_hanscom.af.mil>
Date: Tue, 29 Mar 2011 13:47:41 -0400

I would like to do something like the following:

Fancyhist<-function(x,...) {

# first, process x into xprocess somehow, then ...

  if (is.null(breaks)) { # yes, I know this is wrong
# define the histogram breaks somehow, then call hist:

     hist(xprocess,breaks=breaks,...)
  } else {

# use breaks give in calling argument

     hist(xprocess,...)
  }

}

But, those of you who know R better than I do have already spotted that "is.null(breaks)" just won't work. Neither does "exists" or "missing".

I can think of ways to do this involving new arguments with new names -- like "histbreaks" or something -- but that seems inelegant.

Is there a way to do what I am trying to do here?

Thanks.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Mar 2011 - 17:51:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Mar 2011 - 18:40:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive