Package development process?
I agree with Hadley, and add that trying to have an example be both an example and a test may not be good for the example aspect either. Examples should make people who are ignorant of the function twig as to how the function works. Creating good examples is hard. Problems that really test the software are unlikely to serve as a good example. Good examples are unlikely to seriously test the code. (But you do want the examples to run, it is seriously bad advertising when they don't.) Pat
On 16/06/2010 15:53, Hadley Wickham wrote:
What about the encouragement to add unit tests, if only disguised as examples?
Examples are not unit tests. Examples are a convenient way of testing some aspects of the package, but serve a rather different purpose to tests. The R community does not emphase testing nearly as much as other communities. For example, Ruby has a very strong testing culture including at least 10 different unit testing frameworks.
I've found the unit tests to be a powerful tool to help improve and maintain the quality of packages to which I contribute. To this end, Sundar and I added a column "Autochecks" to the table of "Selected Repositories" in the Wikipedia article on "Software repository" (http://en.wikipedia.org/wiki/Software_repository), and we describe it briefly in the text introducing that table.
Unfortunately your description highlights a inadequacy of R and poor software development procedures on the part of many R package developers (including me!). For exactly the reason you discuss, it's never a good idea for your package to depend on the most current version of another package. If you do, changes to that package might break yours. Most other package management systems allow you to specify the version of a dependency so that this doesn't happen. You can do this with R, but because it's hard to have multiple versions of the same package installed at the same time, it's not as useful. Hadley
Patrick Burns pburns at pburns.seanet.com http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno')