[Rd] setIs() and setAs()
Sebastian P. Luque
spluque at gmail.com
Fri Nov 17 17:34:54 CET 2006
Dear R-devel,
If we have two classes that have the same representation but with slightly
different constraints, say something like:
setClass("foo", representation=c(a="numeric", b="data.frame"))
setClass("bar", contains="foo",
validity=function(object) if (length(object at b) < 2) {
return("b must be longer than 1")
})
I would like to be able to interpret foo as bar, if foo satisfies the
validity argument. I think this requires a call to setIs(), but I'm not
sure what the best way to do this is, considering the necessary setAs()
calls. I would appreciate some suggestions as to how to make the setAs()
and setIs() calls in cases like this. Thanks in advance.
Cheers,
--
Seb
More information about the R-devel
mailing list