[R] NA/NULL slot for a class defined with 'methods'

Laurent Gautier laurent at cbs.dtu.dk
Wed Jul 24 10:00:48 CEST 2002


Dear all,


I would like to signify that a slot of mode "array"
is undefined and I thought that array(), or NA or NULL
would be good choices...

The following examples leave me puzzled:
 
> setClass("test", representation(x="array"))
[1] "test"
> new("test")
An object of class "test"
Slot "x":
numeric(0)

> new("test", x=array())
An object of class "test"
Slot "x":
[1] NA

> new("test", x=NA)
Error in initialize(value, ...) : Invalid object for slot "x", with class "logical", should be or extend class "array"



Is there a way to do it ?


Regards,


Laurent


-- 
--------------------------------------------------------------
Laurent Gautier			CBS, Building 208, DTU
PhD. Student			DK-2800 Lyngby,Denmark	
tel: +45 45 25 24 85		http://www.cbs.dtu.dk/laurent
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list