The key issue is inheritance. If you use a data frame with attributes then you can inherit data frame methods without further definition, e.g.
x <- structure(data.frame(a = 1:10), my.attr = 33, class = c("myclass", "data.frame")) dim(x) # inherit dim method but if you do it this way then you need to define your own methods for each one you want: x <- structure(list(.Data = data.frame(a = 1:10), my.attr = 33), class = "myclass") dim.myclass <- function(x) dim(x$.Data) dim(x) for every method you want. On 8/1/06, Gorjanc Gregor <[EMAIL PROTECTED]> wrote: > Hello! > > I am writing code where I define objects with new class. When I started, > it was a simple data.frame with attributes, but it is getting more evolved > and I would like to hear any pros and cons to go for list structure, > where one "slot" would be a data.frame, while other "slots" would take over > role of attributes. > > Lep pozdrav / With regards, > Gregor Gorjanc > > ---------------------------------------------------------------------- > University of Ljubljana PhD student > Biotechnical Faculty URI: http://www.bfro.uni-lj.si/MR/ggorjan > Zootechnical Department mail: gregor.gorjanc <at> bfro.uni-lj.si > Groblje 3 tel: +386 (0)1 72 17 861 > SI-1230 Domzale fax: +386 (0)1 72 17 888 > Slovenia, Europe > ---------------------------------------------------------------------- > "One must learn by doing the thing; for though you think you know it, > you have no certainty until you try." Sophocles ~ 450 B.C. > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel