Hi, I´m trying to write some R classes but I din´t find documentation enought to develop them. I read there is 2 ways to write classes, using S3 ou S4 models. And it seems that S4 is the best model, so I thing I should use this one. I´m new user of R and I´m searched on the net some information about creating new classes. I found this document: http://www.biostat.harvard.edu/courses/individual/bio271/lectures/L11/S4Objects.pdf If someone knows some docs about creating our own classes, could please, post its url at here ? More one question... It seems that some documents about S can be applyed to R. How do you know if you can use this documentation using R ? I´m asking this because some stufs I was looking for I found more explanation using S and not R. Am I right or I´m looking in the wrong place ? Thanks a lot! __________________________________________________ [[alternative HTML version deleted]]
Fritz's lecture at useR! 2004 may also be a good starting point: http://www.ci.tuwien.ac.at/Conferences/useR-2004/Keynotes/Leisch.pdf Andy> From: Gilvan Justino > > Hi, > > I??m trying to write some R classes but I din??t find > documentation enought to develop them. I read there is 2 ways > to write classes, using S3 ou S4 models. And it seems that S4 > is the best model, so I thing I should use this one. > > I??m new user of R and I??m searched on the net some > information about creating new classes. I found this document: > http://www.biostat.harvard.edu/courses/individual/bio271/lectures/L11/S4Objects.pdf If someone knows some docs about creating our own classes, could please, post its url at here ? More one question... It seems that some documents about S can be applyed to R. How do you know if you can use this documentation using R ? I??m asking this because some stufs I was looking for I found more explanation using S and not R. Am I right or I??m looking in the wrong place ? Thanks a lot! __________________________________________________ [[alternative HTML version deleted]] ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Chambers book, Programming with Data, has a lot about S4. Note that S4 has more features but S3 is simpler and has higher performance so its not all one way. Also, they are related so if you learn the simpler S3 first it will make it easier to learn S4 later. I suggest you download and read the source code for package `zoo' for S3 and package `its' for S4. Both packages define irregular time series classes. Date: Tue, 28 Dec 2004 13:46:10 -0300 (ART) From: Gilvan Justino <giljustino at yahoo.com.br> To: <r-help at stat.math.ethz.ch> Subject: [R] Developing R classes Hi, I´m trying to write some R classes but I din´t find documentation enought to develop them. I read there is 2 ways to write classes, using S3 ou S4 models. And it seems that S4 is the best model, so I thing I should use this one. I´m new user of R and I´m searched on the net some information about creating new classes. I found this document: http://www.biostat.harvard.edu/courses/individual/bio271/lectures/L11/S4Objects.pdf If someone knows some docs about creating our own classes, could please, post its url at here ? More one question... It seems that some documents about S can be applyed to R. How do you know if you can use this documentation using R ? I´m asking this because some stufs I was looking for I found more explanation using S and not R. Am I right or I´m looking in the wrong place ? Thanks a lot!
On Tue, 28 Dec 2004, Gilvan Justino wrote:> Hi, > > I´m trying to write some R classes but I din´t find documentation > enought to develop them. I read there is 2 ways to write classes, using > S3 ou S4 models. And it seems that S4 is the best model, so I thing I > should use this one.There's a small example in the R Newsletter, Volume 1, 2004. -thomas
Gilvan Justino writes: > Hi, > > I??m trying to write some R classes but I din??t find documentation > enought to develop them. I have faced a similar problem. Here is the summary of what I have been able to find (including some of the responses that you have already received) with a focus on S4 classes since some people assert that all new development should be done with them. 1) I think that the three best free resources for learning about S4 classes are (in the order that I recommend you read them): http://www.omegahat.org/RSMethods/Intro.pdf (More or less Section 1.6 from The Green Book.) http://www.stat.auckland.ac.nz/S-Workshop/Gentleman/S4Objects.pdf (I think that this version of the talk is more up-to-date than the one located at the Bioconductor site at http://www.bioconductor.org/develPage/guidelines/programming/S4Objects.pdf) @Article{Rnews:Lumley:2004b, author = {Thomas Lumley}, title = {Programmers' Niche: A Simple Class, in {S3} and {S4}}, journal = {R News}, year = 2004, volume = 4, number = 1, pages = {33--36}, month = {June}, url = {http://CRAN.R-project.org/doc/Rnews/}, } 2) If you want to get serious with S4 classes, you may need to purchase "Programming with Data" by John Chambers (aka The Green Book) and/or "S Programming" by Venable and Ripley. I own both, but am interested in finding material that is similarly comprehensive but free. Many of the people (read: students) that I urge to use R do not have the sort of budgets for buying books that I am lucky enough to have. 3) I found all of these references to be worth a read through. http://www.ci.tuwien.ac.at/Conferences/useR-2004/Keynotes/Leisch.pdf http://www.biostat.jhsph.edu/~rpeng/R-classes-scope.pdf http://www.stat.auckland.ac.nz/S-Workshop/Gentleman/Methods.pdf http://www.molgen.mpg.de/~wolski/Robject/Extending.pdf Hope that helps, Dave Kane PS. I can't access the stat.auckland site right now but have been able to in the past.