I thought that 'validity' defined in 'setClass' should be called in 'new'. Could somebody let me know why 'validity' is not called? How to make it be called?
> setClass( + Class='A', + representation=representation( + x='numeric' + ), + validity=function(object){ + cat("~~~ A: inspector ~~~\n") + if(obj...@x<0){ + stop("[A:validation] obj...@x<0") + } + return(T) + } + ) [1] "A" > setMethod( + f='initialize', + signature='A', + definition=function(.Object,x){ + cat("~~~ A: initializator ~~~\n") + .obj...@x=x + return(.Object) + } + ) [1] "initialize" > new(Class='A', x=10) ~~~ A: initializator ~~~ An object of class \u201cA\u201d Slot "x": [1] 10 ______________________________________________ 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.