diff --git a/vignettes/conmat-population.Rmd b/vignettes/conmat-population.Rmd index 96a2a997..50a1a1e2 100644 --- a/vignettes/conmat-population.Rmd +++ b/vignettes/conmat-population.Rmd @@ -8,9 +8,22 @@ vignette: > --- ```{r, include = FALSE} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + time_it = TRUE ) ``` @@ -212,3 +225,8 @@ If you want to use `conmat_population` within your R package, then please get in # Conclusion That's how we can use the conmat population information! Please go ahead and use and enjoy! + +```{r} +all_times +``` + diff --git a/vignettes/data-sources.Rmd b/vignettes/data-sources.Rmd index 6c85fcee..b5b20302 100644 --- a/vignettes/data-sources.Rmd +++ b/vignettes/data-sources.Rmd @@ -8,9 +8,22 @@ vignette: > --- ```{r, include = FALSE} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + time_it = TRUE ) ``` @@ -203,3 +216,8 @@ eyre_transmission_probabilities %>% axis.text = element_text(angle = 45, hjust = 1) ) ``` + +```{r} +all_times +``` + diff --git a/vignettes/example-pipeline.Rmd b/vignettes/example-pipeline.Rmd index 402dc243..7edc448a 100644 --- a/vignettes/example-pipeline.Rmd +++ b/vignettes/example-pipeline.Rmd @@ -8,9 +8,22 @@ vignette: > --- ```{r, include = FALSE} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + time_it = TRUE ) ``` @@ -268,3 +281,8 @@ This is a bit briefer than the two step process, and might be preferable to crea + +```{r} +all_times +``` + diff --git a/vignettes/getting-started.Rmd b/vignettes/getting-started.Rmd index ec7f9aa7..c3eee958 100644 --- a/vignettes/getting-started.Rmd +++ b/vignettes/getting-started.Rmd @@ -8,9 +8,22 @@ vignette: > --- ```{r, include = FALSE} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + time_it = TRUE ) ``` @@ -310,3 +323,8 @@ autoplot( title = "Setting-specific synthetic contact matrices (fairfield 2020 projected)" ) ``` + +```{r} +all_times +``` + diff --git a/vignettes/other-data-sources.Rmd b/vignettes/other-data-sources.Rmd index 51b92503..623a9c5e 100644 --- a/vignettes/other-data-sources.Rmd +++ b/vignettes/other-data-sources.Rmd @@ -8,9 +8,22 @@ vignette: > --- ```{r, include = FALSE} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + time_it = TRUE ) ``` @@ -99,3 +112,8 @@ ngm_italy_vacc <- apply_vaccination( ngm_italy_vacc ``` + +```{r} +all_times +``` + diff --git a/vignettes/parallel-computing.Rmd b/vignettes/parallel-computing.Rmd index eadf9013..849c5d2f 100644 --- a/vignettes/parallel-computing.Rmd +++ b/vignettes/parallel-computing.Rmd @@ -8,9 +8,22 @@ vignette: > --- ```{r, include = FALSE} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + time_it = TRUE ) ``` @@ -70,3 +83,8 @@ synthetic_settings_5y_perth <- predict_setting_contacts( age_breaks = c(seq(0, 85, by = 5), Inf) ) ``` + +```{r} +all_times +``` + diff --git a/vignettes/sir-model.Rmd b/vignettes/sir-model.Rmd index da0ef35c..50d69819 100644 --- a/vignettes/sir-model.Rmd +++ b/vignettes/sir-model.Rmd @@ -7,10 +7,24 @@ vignette: > %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, - comment = "#>" + comment = "#>", + time_it = TRUE ) + ``` ```{r setup} @@ -564,3 +578,8 @@ conmat_prem_soln %>% So now we have as fair of a comparison of the two matrices as we will get, and yet, there are significant differences in the dynamics of the two models. + +```{r} +all_times +``` + diff --git a/vignettes/visualising-conmat.Rmd b/vignettes/visualising-conmat.Rmd index 5c144efd..b6277845 100644 --- a/vignettes/visualising-conmat.Rmd +++ b/vignettes/visualising-conmat.Rmd @@ -7,16 +7,30 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} +```{r} +all_times <- list() # store the time for each chunk +knitr::knit_hooks$set(time_it = local({ + now <- NULL + function(before, options) { + if (before) { + now <<- Sys.time() + } else { + res <- difftime(Sys.time(), now) + all_times[[options$label]] <<- res + } + } +})) knitr::opts_chunk$set( collapse = TRUE, comment = "#>", + time_it = TRUE, fig.width = 8, fig.height = 8, dev = "png" ) ``` + ```{r setup} library(conmat) ```