[Rd] setIs() and setAs()

From: Sebastian P. Luque <spluque_at_gmail.com>
Date: Fri 17 Nov 2006 - 16:34:54 GMT


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@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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat Nov 18 03:40:34 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 17 Nov 2006 - 17:30:46 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.