[R] Dabbling with R5 setRefClass - Inheritance problems

Johannes Graumann johannes_graumann at web.de
Thu Nov 8 11:02:33 CET 2012


Hello,

I wrote a class like so:

> rcfdpsuperclass <- setRefClass(
> Class="rcfdpsuperclass",
>   fields = list(
>    RcfpdVersion = "character"),
>  methods = list(
>    initialize = function(){
>      'Populates fields with defaults and lock as appropriate'
>      initFields(
>        RcfpdVersion = as.character(packageVersion("RCFPD")))
>      lockBinding(sym="RcfpdVersion",env=.self)
>      }))

And a second one like this:

> sequencesuperclass <- setRefClass(
>  Class="sequencesuperclass",
>  fields = list(
>    test="character"),
>  contains="rcfpdsuperclass")

Executing the latter I get:
> Error in getClass(what, where = where) : 
>  "rcfpdsuperclass" is not a defined class

Does someone have an idea what I am doing wrong?

Thank you for your consideration.

Sincerely, Joh



More information about the R-help mailing list