[R-pkg-devel] A simple question regarding examples
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Thu Sep 21 12:44:44 CEST 2023
On 20/09/2023 8:03 p.m., Hanyu Song wrote:
> Hello,
>
> I have a simple question about including examples. My code depends on a rarely used Python module, so I am using the @examplesIf tag per Hadley Wickham's advice as follows:
>
> #' @examplesIf reticulate::py_module_available('ctef')
> #' res <- my_func(input1, input2)
>
> 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)
> #' }
>
The @examplesIf comments are directed at Roxygen; R checks will never
look at them. R will run tests based on what is in the my_func.Rd
examples section. I'd guess that's pretty similar to your second
version (except for the \dontrun part, which you shouldn't use, as Ivan
said).
Duncan Murdoch
More information about the R-package-devel
mailing list