I looked through the documentation and the mailing lists and could not
find an answer to this. ?My apologies if it has already been answered.
?If it has, a pointer to the relevant discussion would be greatly
appreciated.
Creating S4 classes containing environments exhibits unexpected
behavior/features.? These have a different in two ways:
1) slotName for the data: ".xData" instead of ".Data" and do not respond to the
2) Response to the is.* function seems to indicate that the object
does not know of its inheritance. ?( Notably, the inherits function
works as expected. )
Here is a working illustration:
# ?LIST
setClass( 'inheritList', contains='list')
inList <- new( 'inheritList' )
class( inList )
[1] "inheritList"
attr(,"package")
[1] ".GlobalEnv"
is.list( inList ) ? ? ? ? ?# TRUE
slotNames(inList) ? ? ? ? ?# ".Data"
inherits(inList, 'list' ) ?# TRUE
# ENVIRONMENT
setClass( 'inheritEnv', contains='environment' )
Defining type "environment" as a superclass via class ".environment"
[1] "inheritEnv"
inEnv <- new( 'inheritEnv' )
class(inEnv)
[1] "inheritEnv"
attr(,"package")
[1] ".GlobalEnv"
is.environment(inEnv) ? ? ? ? ? ? # FALSE
slotNames(inEnv) ? ? ? ? ? ? ? ? ?# ".xData"
inherits(inEnv, 'environment' ) ? # TRUE