greta-dev / greta

simple and scalable statistical modelling in R
https://greta-stats.org
Other
518 stars 63 forks source link

Fix undeclared dependency on DiagrammeRsvg #600

Closed njtierney closed 6 months ago

njtierney commented 6 months ago

As said by CRAN:

Please see the problems shown on https://cran.r-project.org/web/checks/check_results_greta.html.

This has an undeclared dependency on DiagrammeRsvg. Packages in Suggests should be used conditionally: see 'Writing R Extensions'. This needs to be corrected even if the missing package(s) become available. It can be tested by checking with _R_CHECK_DEPENDSONLY=true.

Please correct before 2024-01-17 to safely retain your package on CRAN.

This issue seems to be coming up in the vignette

I think I the best way to solve this is to change eval arg of code chunk as suggested in the R packages book

So we would instead have:

diagrammer_installed <- requireNamespace("DiagrammeR", quietly = TRUE)
gr <- plot(m)
DiagrammeR::export_graph(attr(gr, "dgr_graph"),
                         file_name = "figures/full_graph.png",
                         file_type = "png",
                         width = 958 * 2,
                         height = 450 * 2)

I think that's the best solution here.

njtierney commented 6 months ago

fixed in #603