Passing arguments can be tricky ( take a look at plot.default !!).
There may be a better approach then what you have considered.
hist is (S3) generic. So make a method for an S3 class that will
handle data structures like your x. Something like:
class(x ) <- c("zebra",class(x))
hist.zebra <- func
It's easier that you think;
Fancyhist <- function(x, break=NULL, ...) {
# first, process x into xprocess somehow, then ...
if (is.null(breaks)) {
# define the histogram breaks somehow, then call hist:
}
hist(xprocess, break=breaks, ...)
}
/H
On Tue, Mar 29, 2011 at 10:47 AM, Cable,
It is not clear to me exactly what you are looking to do, but if you are
trying to check whether an argument has been passed via ..., I have used
this convention before.
fun <- function(arg, ...) {
opts <- list(...)
if('opt' %in% names(opts)) # Do something...
}
Does that help?
3 matches
Mail list logo