Simply only run  the function conditionally in test, examples, vignettes:

if(requireNamespace(packageName)){

example / vignette / test code

}




On 08.05.2025 15:37, Juan Antonio Garcia Martin 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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

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

Reply via email to