[R-pkg-devel] Functions requiring packages listed on Suggests
Michael Chirico
m|ch@e|ch|r|co4 @end|ng |rom gm@||@com
Thu May 8 17:28:57 CEST 2025
Just don't run those examples on machines lacking the Suggests packages.
With roxygen2 it's as easy as @examplesIf requireNamespace(p, quietly=TRUE).
On Thu, May 8, 2025, 8:19 AM Juan Antonio Garcia Martin <
ja.garcia using cnb.csic.es> wrote:
> Dear mantainers,
>
> I have a question, since one of my packages currently does not pass the
> onSuggest special check.
>
> Two functions of my package require some of the suggested packages
> either in CRAN (DiagrammeR, DiagrammeRsvg and rsvg) or Bioconductor (
> rtracklayer and GenomicRanges), also listed in the suggest section.
>
> The functions detect whether the suggested packages are installed and
> available, and return an error message indicating that the packages
> required to use the function.
>
> In fact DiagrammeR uses the same approach, the function export_graph
> requires both DiagrammeRsvg and rsvg, but they are not listed in the
> imports, it just returns a message when they are not installed.
>
> I have the option of removing the examples, or printing the same
> messages but returning from the functions instead of using stop. What is
> the preferred behavior in these cases?
>
> Best regards,
> Juan Antonio
>
>
>
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list