From spluque at gmail.com  Fri Nov 17 17:34:54 2006
From: spluque at gmail.com (Sebastian P. Luque)
Date: Fri, 17 Nov 2006 10:34:54 -0600
Subject: [Rd] setIs() and setAs()
Message-ID: <874psyowup.fsf@patagonia.sebmags.homelinux.org>

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



[Rd] setIs() and setAs()
Sebastian P. Luque