Gabor Grothendieck wrote: > Try this: > >> setClass("zoo") > [1] "zoo"
'zoo' is I guess intended as an S3 class (from library zoo), so setOldClass('zoo') is appropriate. Otherwise, setClass("zoo") creates a new virtual class. >> setClass("Work",representation=(x="zoo")) This syntax representation=(x="zoo") is doing something quite strange; the correct syntax to create a class with a slot 'x' of type 'zoo' is setClass("Work", representation=c(x="zoo")) or better setClass("Work", representation=representation(x="zoo")) On the other hand to extend the 'zoo' class setClass("Work", representation=representation("zoo")) or setClass("Work", contains="zoo") getClass("Work") after each of the above shows the consequences. Martin > [1] "Work" > > > On Sat, Jun 27, 2009 at 10:01 PM, R_help Help<rhelp...@gmail.com> wrote: >> Hi, >> >> When I define a new class (through setClass), members defined in >> representation argument doesn't seem to like a class. For example, if >> I do the following: >> >> setClass("NotWork",representation=(x="zoo")) >> >> It seems to me that representation members will take in only primitive >> type to R. Is there any way to stuff a class as a member in another >> class? Thank you. >> >> - adschai >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.