[R-pkg-devel] A simple question regarding examples

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu Sep 21 09:07:03 CEST 2023


On Thu, 21 Sep 2023 00:03:11 +0000
Hanyu Song <hanyu.song using duke.edu> wrote:

> Unfortunately, my_func runs overtime during the CRAN check. To
> resolve this, do I simply use the less elegant approach as follows?
> 
> #' \dontrun{
> #' if (reticulate::py_module_available('ctef')) {
> #' res <- my_func(input1, input2)
> #' }

\dontrun{} is reserved for things that either cannot be guaranteed to
work (highly dependent on the user's system), involve examples of
interactive input/output (e.g. ?debugger), or are potentially too
destructive in case they break (e.g. ?connections). The \examples
section should include running code, which example(your_func) should
run. If there's only the \dontrun{} section, it won't pass the review.

For things that ought to work, it's best to reduce inputs further until
the example runs within the time limit. One remaining escape hatch is
\donttest{}, but R CMD check --as-cran still involves running
\donttest{} examples. Putting the whole example in a \donttest{}
section doesn't sound like a good idea either.

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list