[R] length of S4

From: Christophe Genolini <cgenolin_at_u-paris10.fr>
Date: Sat, 15 Mar 2008 21:54:10 +0100


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 15 Mar 2008 - 20:59:56 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 16 Mar 2008 - 00:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive