>
setClass("person",representation(age="numeric",weight="numeric"),prototype(age=NULL,weight=NULL))
[1] "person"
> bob <- new("person",age=30)
Error in validObject(.Object) : 
  invalid class "person" object: invalid object for slot "weight" in class
"person": got class "NULL", should be or extend class "numeric"

So I guess I can only protoype a property to NULL if its defined as ANY?  I
though there might be a way to test if a propery was assigned to get around
this.  Really kinda turns me off from S4 classes :\
-- 
View this message in context: 
http://r.789695.n4.nabble.com/test-to-see-if-a-s4-property-is-assigned-tp2541044p2542958.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to