Skip to content

Commit 635a62a

Browse files
committed
add more sensitive tests to skip if rsvg is not installed
1 parent 141bd6d commit 635a62a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

vignettes/get_started.Rmd

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ file.copy("../man/figures/plotlegend.png",
2626
"figures/plotlegend.png")
2727
2828
diagrammer_svg_installed <- requireNamespace("DiagrammeRsvg", quietly = TRUE)
29+
rsvg_installed <- requireNamespace("rsvg", quietly = TRUE)
30+
svg_things_installed <- diagrammer_svg_installed && rsvg_installed
2931
```
3032

3133
## Installation
@@ -387,7 +389,7 @@ greta provides a plot function for greta models to help you visualise and check
387389
plot(m)
388390
```
389391

390-
```{r plot-hidden, echo = FALSE, eval = diagrammer_svg_installed}
392+
```{r plot-hidden, echo = FALSE, eval = svg_things_installed}
391393
gr <- plot(m)
392394
DiagrammeR::export_graph(attr(gr, "dgr_graph"),
393395
file_name = "figures/full_graph.png",
@@ -408,7 +410,7 @@ The fourth type of node (diamonds) represents probability distributions. These h
408410

409411
For example, a plot of just the prior distribution over `coef` (defined as `coef <- normal(0, 3)`) shows the parameters as data leading into the normal distribution, and a dashed arrow leading out to the distribution's value, the variable `coef`:
410412

411-
```{r plot_coef, echo = FALSE, eval = diagrammer_svg_installed}
413+
```{r plot_coef, echo = FALSE, eval = svg_things_installed}
412414
coef <- normal(0, 3)
413415
m_coef <- model(coef)
414416
gr <- plot(m_coef)
@@ -422,7 +424,7 @@ DiagrammeR::export_graph(attr(gr, "dgr_graph"),
422424

423425
It's the same for the model likelihood, but this time the distribution's parameters are a variable (`sd`) and the result of an operation (`mean`), and the distribution's value is given by data (the observed sepal lengths `y`):
424426

425-
```{r plot_likelihood, echo = FALSE, eval = diagrammer_svg_installed}
427+
```{r plot_likelihood, echo = FALSE, eval = svg_things_installed}
426428
sd <- variable()
427429
y <- as_data(iris$Sepal.Length)
428430
mean <- ones(150)

0 commit comments

Comments
 (0)