Skip to content

Commit

Permalink
replace sys.setenv to withr local environment
Browse files Browse the repository at this point in the history
  • Loading branch information
avallecam committed Feb 27, 2025
1 parent 54d2676 commit 44534d2
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions episodes/superspreading-estimate.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ exercises: 2
```{r setup, echo= FALSE, message = FALSE, warning = FALSE}
library(webshot)
webshot::install_phantomjs(force = TRUE)
Sys.setenv(OPENSSL_CONF="/dev/null")
```


Expand Down Expand Up @@ -110,20 +109,19 @@ epicontacts::vis_epicontacts(epi_contacts)
```

```{r,echo=FALSE}
# visualise contact network
network <-
vis_epicontacts(epi_contacts) %>%
visNetwork::visPhysics(solver = "barnesHut")
fname <- "network.html"
visNetwork::visSave(network, fname)
webshot::webshot(
fname,
delay = 5,
zoom = 10
)
withr::with_envvar(c(OPENSSL_CONF = file.path("/dev", "null")), {
# visualise contact network
network <-
vis_epicontacts(epi_contacts) %>%
visNetwork::visPhysics(solver = "barnesHut")
fname <- "network.html"
visNetwork::visSave(network, fname)
webshot::webshot(
fname,
delay = 5,
zoom = 10
)
})
```

::::::::::::::::::::::::::: spoiler
Expand Down

0 comments on commit 44534d2

Please sign in to comment.