Skip to content
Prev 139578 / 398506 Next

length of S4

Hi the list,

With basic type, length gives the length of the vector
Wtih list, length gives the number of item
With S4 object, length gives...one. Even with an objet with empty slot.

setClass("E",representation(e="numeric"))
[1] "E"
 length(new("E"))
[1] 1
setClass("E",representation(e="matrix"))
[1] "E"
length(new("E"))
[1] 1

Is there a way to get the real length of an S4 objet ? Furthermore, is 
there a simple way to detect that an object is has all its slot to 
object of size zero ?

Thanks

Christophe