Skip to content
Back to formatted view

Raw Message

Message-ID: <47DC3772.3040607@u-paris10.fr>
Date: 2008-03-15T20:54:10Z
From: Christophe Genolini
Subject: 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