[Rd] S4: names stripped during instantiation of grandchildren of numeric class

Vitalie S. vitosmail at rambler.ru
Fri Aug 28 16:07:31 CEST 2009


Dear All,

A small inconsistency (it's probably not even a buglet):


> setClass("A", contains="numeric")
[1] "A"
> names(new("A", c(a=23)))
[1] "a"

> setClass("B", contains="A")
[1] "B"
> names(new("B", c(a=23)))
NULL
>

This is exactly that kind of behavior S4 was invented for, you expect  
names to be there, but they are not :(.

If that behavior is left to be, one would have to implement @names  
manually for children of basic pseudo-classes, which is quite an overhead  
given the functionality is already in base R.

Thanks,
Vitalie.



More information about the R-devel mailing list