Hi Erin, The Chambers book and web page Josh mentioned provide a good description of the S4 object system. Another introduction to S4 is Robert Gentleman's "S4 Classes in 15 pages, more or less" ( http://www.stat.auckland.ac.nz/S-Workshop/Gentleman/S4Objects.pdf). The help pages for ?setClass, ?setGeneric, ?setMethod, ?Classes, and ?Methods also have more details.
The S3 object system is described in detail in a chapter of "Statistical Models in S" by Chambers and Hastie (although I think some of the details are different in R), the R language manual ( http://cran.case.edu/doc/manuals/R-lang.html#Object_002doriented-programming), and the help pages for ?UseMethod, ?class, and ?methods. Chambers and Hastie have an example of designing a class like the standard factor class and extending it to be an ordered factor. The first vignette in Charlotte Maia's ofp package ( http://cran.case.edu/web/packages/ofp/index.html, http://cran.case.edu/web/packages/ofp/vignettes/ofp1.pdf) has a brief example of extending class structures in S3 with a classic OO example of point, circle, and colouredcircle. The focus of the vignette is on the enhancements provided by the ofp package, but the first example only uses S3 without any enhancements. There is also the new S4 reference class system. I think that is only documented in the ?setRefClass help page. John -- John Oleynick Johnson & Johnson Pharmaceutical Research & Development, Non-Clinical Statistics University of Medicine and Dentistry of New Jersey, Ph.D. Candidate joley...@gmail.com On Fri, Mar 4, 2011 at 2:02 AM, Joshua Wiley <jwiley.ps...@gmail.com> wrote: > Hi Erin, > > One good option would be the official manual: > http://cran.r-project.org/doc/manuals/R-exts.html > > It depends to an extent, I think, on what types of methods you would > like to work with and use. FWIW, I have and really enjoy both S > Programming by Venables & Ripley (mostly S3 methods and general > programming, though I am sure that poor summary does not do it > justice) and Software for Data Analysis by John Chambers (S4 methods). > > HTH, > > Josh > > On Thu, Mar 3, 2011 at 9:47 PM, Erin Hodgess <erinm.hodg...@gmail.com> > wrote: > > Dear R People: > > > > What is the best way to learn about classes, methods, extending > > classes, and namespaces, please? > > > > I know a bit about classes, but would like to learn much more. > > > > Thanks in advance for any advice! > > > > Sincerely, > > Erin > > > > > > -- > > Erin Hodgess > > Associate Professor > > Department of Computer and Mathematical Sciences > > University of Houston - Downtown > > mailto: erinm.hodg...@gmail.com > > > > ______________________________________________ > > 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. > > > > > > -- > Joshua Wiley > Ph.D. Student, Health Psychology > University of California, Los Angeles > http://www.joshuawiley.com/ > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.