>>>>> "Seth" == Seth Falcon <[EMAIL PROTECTED]> >>>>> on Thu, 18 May 2006 12:22:36 -0700 writes:
Seth> Ross Boylan <[EMAIL PROTECTED]> writes: >> Is there any good source of information on how S4 classes (and methods) >> work from C? Hmm, yes; there's nothing in the "Writing R Extensions" manual, and there's not so much in the ``The Green Book'' (Chambers 1998), which is prominently cited by Doug Bates (and Saikat Debroy) in the paper given at DSC 2003 (mentioned earlier in this thread, http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Drafts/BatesDebRoy.pdf ) >> E.g., for reading >> how to read a slot value GET_SLOT(); also SET_SLOT(), NEW_OBJECT(), MAKE_CLASS(), ... >> how to invoke a method Well, an S4 method is still an R function so that's partly covered by "R-exts" -- something I may want to avoid, rather call the C function that *underlies* the (R) S4 method... >> how to test if you have an s4 object {I'd usually do those tests in R code} Seth> You might look at Bioconductor's Ruuid package. It does some of this Seth> and is fairly small, so it is easy to see what is going on. Seth> http://bioconductor.org/packages/1.8/bioc/html/Ruuid.html Indeed,. And the package which lead to the paper has later become 'lme4' the C code of which *currently* is in the 'Matrix' package -- which is much larger than Ruuid, but I think still contains a many interesting examples of using S4 classes from C. Since Matrix development uses a publicly-readable subversion archive, you can directly browse the code at https://svn.R-project.org/R-packages/trunk/Matrix/ (but for extensive browsing do download and unpack the released version of from CRAN, e.g., the US mirror, http://cran.us.r-project.org/src/contrib/Descriptions/Matrix.html ) Particularly look at the src/...Matrix.c files and their R/...Matrix.R counterparts. Martin Seth> + seth ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel