Greetings R users,

I was wondering how others are exporting S3 methods in their packages when
the generic is in 'base'.  For example, let's say I want to export a new
pmax method.  The only way I have found to get this to work is by
redefining the function with 'UseMethod' and setting the default method.

#' @export
pmax <- function(...){ UseMethod("pmax") }
#' @export
pmax.default <- function(..., na.rm=FALSE){ base::pmax(..., na.rm=FALSE) }

setClass("myclass")

#' @export
pmax.myclass <- function(..., na.rm = FALSE){
    print('myclass pmax!')
}

Although this works, I get the 'warning'

The following objects are masked from 'package:base':

    pmax


I would like the package build and loading to be as clean as possible but
if this is acceptable and not considered a problem I will let it go.  It
just seems odd that one would to redefine a the generic when in states in
the docs for 'pmax' that it will also work on classed S3 objects but
perhaps I am reading this incorrectly.

Thanks,
Charles

        [[alternative HTML version deleted]]

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to