[R] Should I wrap more package examples in \dontrun{} ?

Gabor Grothendieck ggrothendieck at gmail.com
Tue Sep 3 22:59:34 CEST 2013


On Tue, Sep 3, 2013 at 10:49 AM, Kevin Wright <kw.stat at gmail.com> wrote:
> I have a package with more than 100 datasets, each of which has an
> \examples{} section.  On the plus side, these example test the "R
> ecosystem" to make sure that everything is working (both my package and
> others' packages).  On the down side, changes in this ecosystem have caused
> repeated NOTEs and WARNINGs from CRAN.
>
> As a commentary on one recent R-help discussion, none of the code breakages
> have been caused by use of ":::".  All of the problems have been caused by
> (1) Changes in "stable" packages and (2) changing CRAN requirements (3)
> changes in "beta" packages. In roughly that order.
>
> In the interest of long-term package stability I'm thinking about wrapping
> more of the examples in my package in \dontrun{}.  Especially the parts
> that depend on other packages.
>

You can avoid checks with any of these:
1. wrap your example in:   if (interactive()) { ... }
2. turn your example into a demo
3. turn your example into a unit test using RUnit, svUnit or other
unit testing package

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list