Skip to content
Prev 27102 / 63458 Next

Problem with initialize of S4 classes

Hi Christian --

Does your package have a name space, but not export 'initialize'?
Calling 'new' will then go directly to the default constructors,
generating the error. A different solution would be to define a
constructor in your package

PreFilter <- function(...) {
    new("PreFilter", ...)
}

so that your user would not have to know about the details of calling
new, you could provide helpful arguments to your constructor, and
'pre-processing' of arguments can be done (in the constructor) before
calling 'new' (I find this helpful, to avoid have to be too careful
when constructing initialize methods that deal with both the class and
classes derived from the class).

Martin

cstrato <cstrato at aon.at> writes: