Question

I am trying to build a package that contains own S4 class definitions. R check works but issues the following warning: undefined slot classes in definition mySecond.

I set to classes while one slot in the second class is of class myFirstClass. E.g.:

setClass("myFirst",representation(field_one = "character",
                                  field_two = "list")
         )

setClass("mySecond",representation(a = "character",
                                   b = "myFirst")
         )

Note:Though S4 might be easier to handle I'd like to stick to S4 here, because I am mapping information from a database and prefer S4's stricter definitions in this case. The compilation does work but I try to fulfill CRAN's standards here and want to get rid of the warnings. Btw: getClassDef gives reasonable result for both classes.

Was it helpful?

Solution

Maybe your class definitions are in separate files, and the collation is such that mySecond is defined before myFirst? See the Collate: field in DESCRIPTION (Section 1.1.1 of RShowDoc("R-exts"), or follow one model of structuring packages where a file AllClasses.R contains class definitions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top