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

Duncan Murdoch murdoch.duncan at gmail.com
Tue Sep 3 17:14:13 CEST 2013


On 03/09/2013 10:49 AM, Kevin Wright 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.
>
> I'm interested to know how other package developers approach this problem.
>
As a user of your package, I would find it irritating if example(foo) 
didn't run anything.   It would be more irritating (and would indicate 
sloppiness on your part) if the examples failed when I cut and pasted 
them.  These both suggest leaving the examples running.

As the author of your package, it sounds as though you find it quite 
irritating when other authors break your code.

Isn't the right solution to this to work with the other package authors 
to come up with code that is unlikely to break?  If that's not possible, 
then maybe don't use those packages that cause you trouble.

Duncan Murdoch



More information about the R-help mailing list