[R] package docs: examples format

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Apr 5 15:43:13 CEST 2006


On Wed, 5 Apr 2006, Sarah Goslee wrote:

> Hello,
>
> The package I'm finishing up contains a series of functions
> intended to be run one after the other, as in:
> do data-prep using A()
> run complicated, slow, analysis B()
> do complicated, slow additional analysis C()
> plot the results with D() and E()
>
> Now, in the documentation for each of those functions,
> I put the entire sequence to illustrate the proper sequence.
> But this means that the time-consuming B() and C() run several
> times during package checking, taking far too long.
>
> I know that I can use
> \dontrun{B()}
> to show the sequence in the help without actually executing it each time.
>
> Is that the preferred approach, or is there something "nicer"?

This is generally done by including example(B) or some such in 
the examples for C. (And you will want to mark them by \dontrun().)

> Ideally, I'd like to include one global example that covers all related
> functions, but I can't find a way to do that neatly (other than possibly
> a vignette?).

A demo is an alternative approach.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list