Displaying 1 result from an estimated 1 matches for "orderedaa".
2008 Apr 09
1
coerce methods and inheritance
...ed when my object is an AA instance:
> aa <- new("AA", ii=sample(10, 5))
> as(aa, "integer")
I'm the A->integer coerce method
[1] 10 1 6 4 7
But things don't behave that way anymore if I introduce a direct extension of AA:
setClass("OrderedAA",
contains="AA",
validity=function(object)
{
if (!all(diff(object at ii) >= 0))
return("slot 'ii' is not ordered")
TRUE
}
)
and a method for coercing an A object to an OrderedAA object:
setAs("A"...