[Rd] S4 setClass / initialize misunderstanding

bullard at stat.Berkeley.EDU bullard at stat.Berkeley.EDU
Tue Feb 2 23:12:16 CET 2010

Hi, I recently ran into this problem. I couldn't find any mention of it in
the setClass documentation.

setClass("Foo", representation(file = "character"))
setMethod("initialize", "Foo", function(.Object, file) {
setClass("Bar", contains = "Foo")

And the error:

Error in print(file) : argument "file" is missing, with no default

The workaround is to interchange the setMethod and the second setClass
call, however, it begs the question why is setClass calling an initialize
method? As always, if I have missed documentation concerning this please
point me there.

Thanks, jim

More information about the R-devel mailing list