[Rd] Problem with _new_ if class "lm" in object representatio n.

Witold Eryk Wolski wolski at molgen.mpg.de
Thu Sep 30 15:21:01 CEST 2004


Hi,

Yes indeed. Thanks.

Yours



Eric Lecoutre wrote:

>
> Hi,
>
> For your lm problem, you could begin to create a virtual class that 
> accepts either NULL or a lm object:
>
> > setClassUnion("mylm", c("NULL","lm"))
> > setClass("foo", representation(x="numeric", y="mylm"))
> > new("foo",x=1,y=NULL)
>
> Then, you have to check the content of slot y in any function that 
> will manipulate objects of class "foo":
>
>
>         setMethod("show","foo",function(object)
>         {
>         cat("\n object of class foo")
>         if (!is.null(object at y)) cat(" does have a lm object in slot y!")
>         })
>
>
> Eric
>


-- 
Dipl. bio-chem. Witold Eryk Wolski         
MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin           _
tel: 0049-30-83875219                   'v'
http://www.molgen.mpg.de/~wolski       /   \
mail: witek96 at users.sourceforge.net  ---W-W----
      wolski at molgen.mpg.de



More information about the R-devel mailing list