I would like to write an S4 generic for 'median', but I am not sure how to do this properly as the function does not have a "..." argument
I can do this setGeneric("median", function(x, na.rm=FALSE) standardGeneric("median")) but I want to be able to pass it a number of objects of the same class, so I need a ... argument; or use signature='list' which is not very useful. I can do this: setGeneric("median", function(x, ..., na.rm=FALSE) standardGeneric("median")) and setMethod('median', signature(x='ANY'), function(x, ..., na.rm=FALSE){ x <- c(x, ...) return(stats::median(x, na.rm=na.rm)) # } #) setMethod("median", signature(x='Raster'), function(x, ..., na.rm=FALSE){ # rasters <- list(...) ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel