[R] setMethod("min", "myclass", ...)

Thomas Stabla statho3 at web.de
Tue Dec 2 19:06:05 CET 2003


Hello,

I have defined a new class

> setClass("myclass", representation(min = "numeric", max = "numeric"))

and want to write accessor functions, so that for

> foo = new("myclass", min = 0, max = 1)
> min(foo) # prints 0
> max(foo) # prints 1

At first i created a generic function for "min"

> setGeneric("min", function(..., na.rm = FALSE) standardGeneric("min"))

and then tried to use setMethod. And there's my problem, I don't know the
name of the first argument which is to be passed to "min".
I can't just write:

> setMethod("min", "myclass", function(..., na.rm = FALSE) ... at min)

The same problem occurs with "max".

Thanks for your help.

Greetings,
Thomas Stabla




More information about the R-help mailing list