Displaying 1 result from an estimated 1 matches for "validfooobject".
2003 Nov 19
2
Was: setValidity and "initialize" method conflict ? [in R-help]
...language R
[But the same behaviour ouccured under R 1.8.0]
Following piece of code works fine, just like we expected it to
-------------------------------------------------------------------------
>setClass("Foo", representation(woo = "numeric"))
[1] "Foo"
>validFooObject <- function(object) {
+ if(object@woo > 0) return(TRUE)
+ else return("warning: negative value for woo")}
>setValidity("Foo", validFooObject)
[1] "Foo"
>new("Foo", woo = 1) # all is fine
An object of class "Foo"
Slot "woo&qu...