R S4 .Data inheritance error -
i have 3 packages, pkga (defines class 'a'), pkgb (defines class 'b') & pkgc (defines class 'c' , class 'broken'). inheritance diagram looks this:
pkga class | --------- | | pkgb class b | | | pkgc class c class broken
the definition of 'broken' is:
setclass('broken', representation('a', content = 'list'))
when try create new one, error:
> library(pkgc) > new('broken', content = list()) error in validobject(.object) : invalid class “broken” object: error in getdatapart(<s4 object of class structure("broken", package = "pkgc")>) : data part undefined general s4 object
does know going on? else able reproduce problem?
i noticed that:
> getclass('broken') class "broken" [package "pkgc"] slots: name: .data content class: list extends: class "a", data part
contains .data part, think wrong. has come from? why there? bug in setclass?
to produce problem, required following files (which available in small github repository here: http://github.com/bluewomble/inheritance_problem)
pkga
pkga/r/classes.r
setclass('a', representation('virtual'))
pkga/namespace
exportclass(a)
pkga/description
package: pkga type: package title: test package version: 1.0 date: 2014-03-20 author: n other maintainer: n other <another@dev.null> description: test license: gpl depends: methods collate: classes.r
pkgb
pkgb/r/classes.r
setclass('b', representation('a'))
pkgb/namespace
exportclass(b) importclassesfrom(pkga,a)
pkgb/description
package: pkgb type: package title: test package b version: 1.0 date: 2014-03-20 author: n other maintainer: n other <another@dev.null> description: test license: gpl depends: methods, pkga collate: classes.r
pkgc
pkgc/r/classes.r
setclass('c', representation('b')) setclass('broken', representation('a', content = 'list'))
pkgc/namespace
exportclass(c) exportclass(broken) importclassesfrom(pkga,a) importclassesfrom(pkgb,b)
pkgc/description
package: pkgc type: package title: test package c version: 1.0 date: 2014-03-20 author: n other maintainer: n other <another@dev.null> description: test license: gpl depends: methods, pkga, pkgb collate: classes.r
i'm using r 3.0.2 on ubuntu.
Comments
Post a Comment