Re: [Rd] Please explain your workflow from R code -> package -> R code -> package

From: Hadley Wickham <hadley_at_rice.edu>
Date: Fri, 09 Sep 2011 13:43:43 -0500

>> If you write the *.Rd file before (like Spencer) or soon after writing the
>> code, then design errors will usually stick out at you, and you can modify
>> the functions.  If you keep your functions small, you'll get them working
>> early, and won't have a lot of problems keeping them in sync with the docs,
>> because they won't change much once you get them right.
>
> For me, the benefits are huge:  I believe I tripled my software development
> productivity almost overnight when I started writing documentation with
> examples (unit tests) before writing the code.  Then I run "R CMD check"
> after every tiny change.  This may seem like extra work, but it saves
> debugging time, because any new problems are likely restricted to what I
> changed.  For example, I write a function A.  Then I write B.  Then I write
> C.  In the process of writing C, I change A.  R CMD check after adding C
> reveals that the change to A broke B.  Without the R package discipline, it
> could easily be a year before a found that a bug existed, and then it was an
> enormous effort to find and fix it.  (See Wikipedia, "Software repository",
> "Package development process".)  In addition to having better code is less
> time for myself, I can easily share the results with others -- thereby
> increasing my productivity substantially more than the factor of three I
> mentioned.

The eventual goal for the devtools package is to make this fast and completely automated, so that while you are editing your package you have another window open that detects any problems as soon as you make them. This isn't quite possible with R CMD check because it's so thorough, which tends to make it rather slow. But if you know what's changed, you should be able to selectively figure out what pieces of the check to run.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 09 Sep 2011 - 19:01:02 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 09 Sep 2011 - 21:40:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive