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

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to