I'm planning to start writing R packages.
I thought it would be good to study the source code of existing packages in order to learn the conventions of package construction.
My criteria for good packages to study:
- Simple statistical/technical ideas: The point is to learn about the mechanics of package construction. Understanding the package should not require detailed highly domain specific knowledge about the actual topic of the package.
- Simple and conventional coding style: I'm looking for something a bit more than
Hello Worldbut not a whole lot more. Idiosyncratic tricks and hacks would be distracting when first learning R packages.
- Good coding style: The code is well written. It reveals both an understanding of good coding, in general, and an awareness of the conventions of coding in R.
- Which packages would be good to study?
- Why would the suggested package source code be good to study relative either to the criteria mentioned above or any other criteria that might be relevant?
Update (13/12/2010) Following Dirk's comments I wanted to make it clear that no doubt many packages would be good to study first. I also agree that packages will provide models for different things (e.g., vignettes, S3 classes, S4 classes, unit testing, Roxygen, etc.). Nonetheless, it would be interesting to read concrete suggestions about good packages to start with and the reasons why they would be good packages to start with.
I've also updated the question above to refer to "packages" rather than "package".