From ce15fa9f34d4da281e9977453caabde3f5d41352 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Wed, 7 Aug 2024 19:53:14 +0000 Subject: [PATCH 01/48] add test --- R/autoplot.pop_data.R | 17 ++++++++++------- tests/testthat/test-autoplot.pop_data.R | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 tests/testthat/test-autoplot.pop_data.R diff --git a/R/autoplot.pop_data.R b/R/autoplot.pop_data.R index efbd0a09..e50686af 100644 --- a/R/autoplot.pop_data.R +++ b/R/autoplot.pop_data.R @@ -37,8 +37,11 @@ autoplot.pop_data <- function( density_plot(object, strata, log) } else { cli::cli_abort( - '`type = "{type}"` is not a valid input; - the currently available options for `type` are "density" or "age-scatter"' + class = "unavailable_type", + message = c( + "Can't create plotting facets with the specified `type` = {.arg {type}}.", + "i" = "The `type` argument accepts 'density' or 'age-scatter' options." + ) ) } } @@ -51,11 +54,11 @@ age_scatter <- function( if (is.null(strata)) { plot1 <- object %>% - ggplot2::ggplot(ggplot2::aes(x = .data[[object %>% get_age_var()]], - y = .data[[object %>% get_value_var()]], - col = get(strata) - ) - ) + ggplot2::ggplot(ggplot2::aes( + x = .data[[object %>% get_age_var()]], + y = .data[[object %>% get_value_var()]], + col = get(strata) + )) } else { plot1 <- object %>% diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R new file mode 100644 index 00000000..b44b2a45 --- /dev/null +++ b/tests/testthat/test-autoplot.pop_data.R @@ -0,0 +1,14 @@ +test_that("`autoplot.pop_data()` raise an error when unavailale type is provided", { + xs_data <- load_pop_data( + file_path = "https://osf.io/download//n6cp3/", + age = "Age", + id = "index_id", + value = "result", + standardize = TRUE + ) + + expect_error( + object = xs_data %>% + autoplot(strata = "Country", type = "den") + ) +}) From c6624e060208cb20afb8a743ad0ca8f83b7a2ad2 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Mon, 2 Sep 2024 12:05:07 +0300 Subject: [PATCH 02/48] add additional error communication --- R/autoplot.pop_data.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/R/autoplot.pop_data.R b/R/autoplot.pop_data.R index e50686af..215a1ea7 100644 --- a/R/autoplot.pop_data.R +++ b/R/autoplot.pop_data.R @@ -31,6 +31,14 @@ autoplot.pop_data <- function( type = "density", strata = NULL, ...) { + + if(!is.element(strata, names(object))){ + cli::cli_abort( + class = "unavailable_strata", + message = c("x"="The option {.var {strata}} for argument {.arg strata} does not exist", + "i" = "Provide a column that exist in {.envvar object}") + ) + } if (type == "age-scatter") { age_scatter(object, strata) } else if (type == "density") { @@ -39,7 +47,7 @@ autoplot.pop_data <- function( cli::cli_abort( class = "unavailable_type", message = c( - "Can't create plotting facets with the specified `type` = {.arg {type}}.", + "x"= "Can't create plotting facets with the specified `type` = {.arg {type}}.", "i" = "The `type` argument accepts 'density' or 'age-scatter' options." ) ) From 6710bd64eaf1df375a304e7ec9ebe58ac07d9e7b Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Thu, 12 Sep 2024 01:03:36 +0300 Subject: [PATCH 03/48] add correct strata --- vignettes/articles/scrubTyphus_example.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index b1cc5045..dc7e3b40 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -123,7 +123,7 @@ Let's also take a look at how antibody responses change by age. ```{r "plot age"} # Plot antibody responses by age -autoplot(object = xs_data, type = "age-scatter", strata = "Country") +autoplot(object = xs_data, type = "age-scatter", strata = "country") ``` From 990c854cecfeff70ff7aed48cd00fcf1634e4b2c Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Thu, 12 Sep 2024 13:06:46 +0300 Subject: [PATCH 04/48] Increment version number to 1.3.0 --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e7072383..f3d6880a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: serocalculator Type: Package Title: Estimating Infection Rates from Serological Data -Version: 1.2.0.9000 +Version: 1.3.0 Authors@R: c( person(given = "Peter", family = "Teunis", email = "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), person(given = "Kristina", family = "Lai", email = "kwlai@ucdavis.edu", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index 41549599..85e7b9b0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# serocalculator (development version) +# serocalculator 1.3.0 # serocalculator 1.2.0 * Added `test-summary.pop_data` test From bc0cb25d3a23525cfb771c210f6d03a8e3cd9f37 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Thu, 12 Sep 2024 13:43:30 +0300 Subject: [PATCH 05/48] increment versioning --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 85e7b9b0..ac15bb62 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # serocalculator 1.3.0 +* Improve error communication for `autoplot.pop_data()` + # serocalculator 1.2.0 * Added `test-summary.pop_data` test From dd0bd6b062b69999d489227bd39f1c98d4090649 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Thu, 12 Sep 2024 16:35:49 +0300 Subject: [PATCH 06/48] correct versioning changes --- DESCRIPTION | 4 ---- 1 file changed, 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9f973e25..f3d6880a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,7 @@ Package: serocalculator Type: Package Title: Estimating Infection Rates from Serological Data -<<<<<<< HEAD Version: 1.3.0 -======= -Version: 1.2.0.9001 ->>>>>>> 00948ca81c61a7664c00793863a84628800dabd0 Authors@R: c( person(given = "Peter", family = "Teunis", email = "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), person(given = "Kristina", family = "Lai", email = "kwlai@ucdavis.edu", role = c("aut", "cre")), From 98b8f0813892cb2d01e3a73eb498f761f199a42f Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 15 Sep 2024 22:58:24 +0300 Subject: [PATCH 07/48] lint files --- R/autoplot.pop_data.R | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/R/autoplot.pop_data.R b/R/autoplot.pop_data.R index 215a1ea7..3bcfce16 100644 --- a/R/autoplot.pop_data.R +++ b/R/autoplot.pop_data.R @@ -4,9 +4,11 @@ #' #' @param object A `pop_data` object (from [load_pop_data()]) #' @param log whether to show antibody responses on logarithmic scale -#' @param strata the name of a variable in `pop_data` to stratify by (or `NULL` for no stratification) +#' @param strata the name of a variable in `pop_data` +#' to stratify by (or `NULL` for no stratification) #' @param ... unused -#' @param type an option to choose type of chart: the current options are `"density"` or `"age-scatter"` +#' @param type an option to choose type of chart: +#' the current options are `"density"` or `"age-scatter"` #' #' @return a [ggplot2::ggplot] object #' @@ -31,12 +33,14 @@ autoplot.pop_data <- function( type = "density", strata = NULL, ...) { - - if(!is.element(strata, names(object))){ + if (!is.element(strata, names(object))) { cli::cli_abort( class = "unavailable_strata", - message = c("x"="The option {.var {strata}} for argument {.arg strata} does not exist", - "i" = "Provide a column that exist in {.envvar object}") + message = c( + "x" = paste0("The option {.var {strata}}", + "for argument {.arg strata} does not exist"), + "i" = "Provide a column that exist in {.envvar object}" + ) ) } if (type == "age-scatter") { @@ -47,7 +51,8 @@ autoplot.pop_data <- function( cli::cli_abort( class = "unavailable_type", message = c( - "x"= "Can't create plotting facets with the specified `type` = {.arg {type}}.", + "x" = paste0("Can't create plotting facets", + " with the specified `type` = {.arg {type}}."), "i" = "The `type` argument accepts 'density' or 'age-scatter' options." ) ) @@ -84,7 +89,7 @@ age_scatter <- function( ggplot2::theme_linedraw() + # ggplot2::scale_y_log10() + - # avoid log 0 (https://forum.posit.co/t/using-log-transformation-but-need-to-preserve-0/129197/4) + # avoid log 0 (https://bit.ly/4eqDkT4) ggplot2::scale_y_continuous( trans = scales::pseudo_log_trans(sigma = 0.01), breaks = c(-1, -0.1, 0, 0.1, 1, 10), From 1080bba9a8c9e4240026c5eeec7a9dd99af7bcc5 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 15 Sep 2024 23:23:24 +0300 Subject: [PATCH 08/48] add documentation --- man/autoplot.pop_data.Rd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/man/autoplot.pop_data.Rd b/man/autoplot.pop_data.Rd index 177e283b..c6e0908b 100644 --- a/man/autoplot.pop_data.Rd +++ b/man/autoplot.pop_data.Rd @@ -11,9 +11,11 @@ \item{log}{whether to show antibody responses on logarithmic scale} -\item{type}{an option to choose type of chart: the current options are \code{"density"} or \code{"age-scatter"}} +\item{type}{an option to choose type of chart: +the current options are \code{"density"} or \code{"age-scatter"}} -\item{strata}{the name of a variable in \code{pop_data} to stratify by (or \code{NULL} for no stratification)} +\item{strata}{the name of a variable in \code{pop_data} +to stratify by (or \code{NULL} for no stratification)} \item{...}{unused} } From ada135b4a2d3ce2f2f72b7e8bf11abc9e0872d23 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Mon, 16 Sep 2024 00:14:38 +0300 Subject: [PATCH 09/48] lint files --- R/autoplot.pop_data.R | 4 +++- tests/testthat/test-autoplot.pop_data.R | 3 ++- vignettes/articles/scrubTyphus_example.Rmd | 22 ++++++++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/R/autoplot.pop_data.R b/R/autoplot.pop_data.R index 3bcfce16..297b6a30 100644 --- a/R/autoplot.pop_data.R +++ b/R/autoplot.pop_data.R @@ -140,10 +140,12 @@ density_plot <- function( if (log) { min_nonzero_val <- object %>% - filter(object %>% get_value() > 0) %>% + filter(object %>% + get_value() > 0) %>% get_value() %>% min() + max_val <- object %>% get_value() %>% diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index b44b2a45..e2a18339 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -1,4 +1,5 @@ -test_that("`autoplot.pop_data()` raise an error when unavailale type is provided", { +test_that("`autoplot.pop_data()` raise + an error when unavailale type is provided", { xs_data <- load_pop_data( file_path = "https://osf.io/download//n6cp3/", age = "Age", diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index dc7e3b40..28369609 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -45,15 +45,10 @@ knitr::opts_chunk$set( ### Load packages The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. -```{r setup, message=FALSE} -# devtools::install_github("ucd-serg/serocalculator", eval=FALSE) -``` ```{r load_packages} library(serocalculator) -# install.packages("tidyverse") library(tidyverse) -# install.packages("mixtools") library(mixtools) ``` @@ -155,12 +150,20 @@ b.noise <- xs_data %>% do({ set.seed(54321) # Fit the mixture model - mixmod <- normalmixEM(.$value, k = 2, maxit = 1000) # k is the number of components, adjust as necessary + mixmod <- normalmixEM(.$value, + k = 2, + maxit = 1000 + ) + # k is the number of components, adjust as necessary # Assuming the first component is the lower distribution lower_mu <- mixmod$mu[1] lower_sigma <- sqrt(mixmod$sigma[1]) # Calculate the 90th percentile of the lower distribution - percentile75 <- qnorm(0.75, lower_mu, lower_sigma) + percentile75 <- qnorm( + 0.75, + lower_mu, + lower_sigma + ) # Return the results data.frame(antigen_iso = .$antigen_iso[1], percentile75 = percentile75) }) @@ -241,7 +244,10 @@ est.comb <- rbind(estdf, est2df) # Create barplot (rescale incidence rate and CIs) ggplot(est.comb, aes(y = ageQ, x = incidence.rate * 1000, fill = country)) + - geom_bar(stat = "identity", position = position_dodge2(width = 0.8, preserve = "single")) + + geom_bar( + stat = "identity", + position = position_dodge2(width = 0.8, preserve = "single") + ) + geom_linerange(aes(xmin = CI.lwr * 1000, xmax = CI.upr * 1000), position = position_dodge2(width = 0.8, preserve = "single") ) + From f4c3b7d27ebb127bc421d2c6ca6a224a479566b8 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Tue, 17 Sep 2024 11:19:03 +0300 Subject: [PATCH 10/48] lint test file --- tests/testthat/test-autoplot.pop_data.R | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index e2a18339..42e3a1d9 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -1,15 +1,14 @@ test_that("`autoplot.pop_data()` raise an error when unavailale type is provided", { - xs_data <- load_pop_data( - file_path = "https://osf.io/download//n6cp3/", - age = "Age", - id = "index_id", - value = "result", - standardize = TRUE - ) - - expect_error( - object = xs_data %>% - autoplot(strata = "Country", type = "den") - ) -}) + xs_data <- load_pop_data( + file_path = "https://osf.io/download//n6cp3/", + age = "Age", + id = "index_id", + value = "result", + standardize = TRUE + ) + expect_error( + object = xs_data %>% + autoplot(strata = "Country", type = "den") + ) + }) From 43f3681d12020d7827093f7a52f558a37aae0a25 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 13:43:00 -0700 Subject: [PATCH 11/48] cleanup --- DESCRIPTION | 3 +- R/autoplot.pop_data.R | 46 +- .../autoplot.pop_data.density.svg | 166 + ...autoplot_pop_data_age_scatter-no_strat.svg | 3412 ++++++++++++++++ ...lot_pop_data_age_scatter-strat_country.svg | 3428 +++++++++++++++++ tests/testthat/test-autoplot.pop_data.R | 80 +- 6 files changed, 7108 insertions(+), 27 deletions(-) create mode 100644 tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data.density.svg create mode 100644 tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-no_strat.svg create mode 100644 tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-strat_country.svg diff --git a/DESCRIPTION b/DESCRIPTION index 72e5e73e..1a30553a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,8 @@ Imports: tidyr, utils, tidyselect, - cli + cli, + purrr Suggests: parallel, knitr, diff --git a/R/autoplot.pop_data.R b/R/autoplot.pop_data.R index 297b6a30..e4e7bbd7 100644 --- a/R/autoplot.pop_data.R +++ b/R/autoplot.pop_data.R @@ -33,16 +33,18 @@ autoplot.pop_data <- function( type = "density", strata = NULL, ...) { - if (!is.element(strata, names(object))) { + + if (!is.null(strata) && !is.element(strata, names(object))) { cli::cli_abort( class = "unavailable_strata", message = c( - "x" = paste0("The option {.var {strata}}", - "for argument {.arg strata} does not exist"), - "i" = "Provide a column that exist in {.envvar object}" + x = "The variable {.var {strata}} specified by argument {.arg strata} + does not exist in {.arg object}.", + i = "Please choose a column that exists in {.arg object}." ) ) } + if (type == "age-scatter") { age_scatter(object, strata) } else if (type == "density") { @@ -51,9 +53,9 @@ autoplot.pop_data <- function( cli::cli_abort( class = "unavailable_type", message = c( - "x" = paste0("Can't create plotting facets", - " with the specified `type` = {.arg {type}}."), - "i" = "The `type` argument accepts 'density' or 'age-scatter' options." + x = "{.fn autoplot.pop_data} does not currently have an option for + {.arg type} = {.str {type}}.", + i = "The {.arg type} argument accepts options {.str density} or {.str age-scatter}." ) ) } @@ -61,26 +63,27 @@ autoplot.pop_data <- function( age_scatter <- function( object, - strata = NULL) { + strata = NULL, + age_var = object %>% get_age_var(), + value_var = object %>% get_value_var()) { # create default plotting if (is.null(strata)) { plot1 <- object %>% - ggplot2::ggplot(ggplot2::aes( - x = .data[[object %>% get_age_var()]], - y = .data[[object %>% get_value_var()]], - col = get(strata) - )) + ggplot2::ggplot() + + ggplot2::aes( + x = .data[[age_var]], + y = .data[[value_var]] + ) } else { plot1 <- object %>% - ggplot2::ggplot( - ggplot2::aes( - x = .data[[object %>% get_age_var()]], - y = .data[[object %>% get_value_var()]] - ), - col = get(strata) + ggplot2::ggplot() + + ggplot2::aes( + col = .data[[strata]], + x = .data[[age_var]], + y = .data[[value_var]] ) + ggplot2::labs(colour = strata) } @@ -138,14 +141,13 @@ density_plot <- function( ggplot2::labs(fill = strata) } if (log) { + min_nonzero_val <- object %>% - filter(object %>% - get_value() > 0) %>% get_value() %>% + purrr::keep(~ . > 0) %>% min() - max_val <- object %>% get_value() %>% diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data.density.svg b/tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data.density.svg new file mode 100644 index 00000000..fed3c9cf --- /dev/null +++ b/tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data.density.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +HlyE_IgG + + + + + + + + + + +HlyE_IgA + + + + + + + +0 +50 +100 +150 +200 +0.0 +0.1 +0.2 +0.3 +0.4 + + + + + +0.0 +0.1 +0.2 +0.3 +0.4 + + + + + +Antibody Response Value +Frequency + +Country + + + + + + +Bangladesh +Nepal +Pakistan +Distribution of Cross-sectional Antibody Responses + + diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-no_strat.svg b/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-no_strat.svg new file mode 100644 index 00000000..f81e3761 --- /dev/null +++ b/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-no_strat.svg @@ -0,0 +1,3412 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.0 +0.1 +1.0 +10.0 + + + + + + + + + + +0 +5 +10 +15 +20 +25 +Age +Antibody Response Value +Quantitative Antibody Responses by Age + + diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-strat_country.svg b/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-strat_country.svg new file mode 100644 index 00000000..1a356ca0 --- /dev/null +++ b/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-strat_country.svg @@ -0,0 +1,3428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0.0 +0.1 +1.0 +10.0 + + + + + + + + + + +0 +5 +10 +15 +20 +25 +Age +Antibody Response Value + +Country + + + + + + + + + +Bangladesh +Nepal +Pakistan +Quantitative Antibody Responses by Age + + diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index 42e3a1d9..13df9c45 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -1,5 +1,6 @@ test_that("`autoplot.pop_data()` raise - an error when unavailale type is provided", { + an error when unavailable type is provided", + { xs_data <- load_pop_data( file_path = "https://osf.io/download//n6cp3/", age = "Age", @@ -7,8 +8,79 @@ test_that("`autoplot.pop_data()` raise value = "result", standardize = TRUE ) - expect_error( - object = xs_data %>% - autoplot(strata = "Country", type = "den") + expect_error(object = xs_data %>% + autoplot(strata = "Country", type = "den")) + }) + +test_that("`autoplot.pop_data()` raise + an error when unavailable `strata` is provided", + { + xs_data <- load_pop_data( + file_path = "https://osf.io/download//n6cp3/", + age = "Age", + id = "index_id", + value = "result", + standardize = TRUE ) + expect_error(object = xs_data %>% + autoplot(strata = "strat1", type = "density")) + }) + +test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`", + { + xs_data <- load_pop_data( + file_path = "https://osf.io/download//n6cp3/", + age = "Age", + id = "index_id", + value = "result", + standardize = TRUE + ) %>% + autoplot(strata = "Country", type = "density") %>% + ggplot2::ggsave( + filename = tempfile(), + device = "svg", + width = 8, + height = 8 + ) %>% + expect_snapshot_file(name = "autoplot.pop_data.density.svg") + }) + +test_that("`autoplot.pop_data()` produces stable results for + `type = 'age-scatter'`", + { + xs_data <- load_pop_data( + file_path = "https://osf.io/download//n6cp3/", + age = "Age", + id = "index_id", + value = "result", + standardize = TRUE + ) %>% + autoplot(strata = "Country", type = "age-scatter") %>% + ggplot2::ggsave( + filename = tempfile(), + device = "svg", + width = 8, + height = 8 + ) %>% + expect_snapshot_file(name = "autoplot_pop_data_age_scatter-strat_country.svg") + }) + +test_that("`autoplot.pop_data()` produces stable results + for `type = 'age-scatter' no strat`", + { + xs_data <- load_pop_data( + file_path = "https://osf.io/download//n6cp3/", + age = "Age", + id = "index_id", + value = "result", + standardize = TRUE + ) %>% + autoplot(strata = NULL, type = "age-scatter") %>% + ggplot2::ggsave( + filename = tempfile(), + device = "svg", + width = 8, + height = 8 + ) %>% + expect_snapshot_file(name = "autoplot_pop_data_age_scatter-no_strat.svg") }) From ba40406f9328d618124120c1b1881708fb3fa0b9 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 14:18:54 -0700 Subject: [PATCH 12/48] add svglite for snapshot file tests --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1a30553a..6ae449e3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -44,7 +44,8 @@ Suggests: bookdown, ggbeeswarm, DT, - spelling + spelling, + svglite LazyData: true Encoding: UTF-8 URL: https://github.com/UCD-SERG/serocalculator, https://ucd-serg.github.io/serocalculator/ From 1cef025f51f5aa46bc357e27750fa13608767b16 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 15:08:55 -0700 Subject: [PATCH 13/48] make snap file names OS-portable --- ...t.pop_data.density.svg => autoplot.pop_data_density.svg} | 0 ...strat.svg => autoplot_pop_data_age_scatter_no_strat.svg} | 0 ....svg => autoplot_pop_data_age_scatter_strat_country.svg} | 0 tests/testthat/test-autoplot.pop_data.R | 6 +++--- 4 files changed, 3 insertions(+), 3 deletions(-) rename tests/testthat/_snaps/autoplot.pop_data/{autoplot.pop_data.density.svg => autoplot.pop_data_density.svg} (100%) rename tests/testthat/_snaps/autoplot.pop_data/{autoplot_pop_data_age_scatter-no_strat.svg => autoplot_pop_data_age_scatter_no_strat.svg} (100%) rename tests/testthat/_snaps/autoplot.pop_data/{autoplot_pop_data_age_scatter-strat_country.svg => autoplot_pop_data_age_scatter_strat_country.svg} (100%) diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data.density.svg b/tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data_density.svg similarity index 100% rename from tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data.density.svg rename to tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data_density.svg diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-no_strat.svg b/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_no_strat.svg similarity index 100% rename from tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-no_strat.svg rename to tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_no_strat.svg diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-strat_country.svg b/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_strat_country.svg similarity index 100% rename from tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter-strat_country.svg rename to tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_strat_country.svg diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index 13df9c45..ecb3331e 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -42,7 +42,7 @@ test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`" width = 8, height = 8 ) %>% - expect_snapshot_file(name = "autoplot.pop_data.density.svg") + expect_snapshot_file(name = "autoplot.pop_data_density.svg") }) test_that("`autoplot.pop_data()` produces stable results for @@ -62,7 +62,7 @@ test_that("`autoplot.pop_data()` produces stable results for width = 8, height = 8 ) %>% - expect_snapshot_file(name = "autoplot_pop_data_age_scatter-strat_country.svg") + expect_snapshot_file(name = "autoplot_pop_data_age_scatter_strat_country.svg") }) test_that("`autoplot.pop_data()` produces stable results @@ -82,5 +82,5 @@ test_that("`autoplot.pop_data()` produces stable results width = 8, height = 8 ) %>% - expect_snapshot_file(name = "autoplot_pop_data_age_scatter-no_strat.svg") + expect_snapshot_file(name = "autoplot_pop_data_age_scatter_no_strat.svg") }) From 8f8d2360c02b9800207c83be260d1e262fe655bc Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 15:29:14 -0700 Subject: [PATCH 14/48] remove function name prefix from snap filenames. --- tests/testthat/test-autoplot.pop_data.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index ecb3331e..ce3766d3 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -42,7 +42,7 @@ test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`" width = 8, height = 8 ) %>% - expect_snapshot_file(name = "autoplot.pop_data_density.svg") + expect_snapshot_file(name = "density.svg") }) test_that("`autoplot.pop_data()` produces stable results for @@ -62,7 +62,7 @@ test_that("`autoplot.pop_data()` produces stable results for width = 8, height = 8 ) %>% - expect_snapshot_file(name = "autoplot_pop_data_age_scatter_strat_country.svg") + expect_snapshot_file(name = "age_scatter_strat_country.svg") }) test_that("`autoplot.pop_data()` produces stable results @@ -82,5 +82,5 @@ test_that("`autoplot.pop_data()` produces stable results width = 8, height = 8 ) %>% - expect_snapshot_file(name = "autoplot_pop_data_age_scatter_no_strat.svg") + expect_snapshot_file(name = "age_scatter_no_strat.svg") }) From cde0062fd79025591fac7256c2f938dc09f84f46 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 16:43:10 -0700 Subject: [PATCH 15/48] rename --- ...pop_data_age_scatter_no_strat.svg => age_scatter_no_strat.svg} | 0 ...ge_scatter_strat_country.svg => age_scatter_strat_country.svg} | 0 .../{autoplot.pop_data_density.svg => density.svg} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename tests/testthat/_snaps/autoplot.pop_data/{autoplot_pop_data_age_scatter_no_strat.svg => age_scatter_no_strat.svg} (100%) rename tests/testthat/_snaps/autoplot.pop_data/{autoplot_pop_data_age_scatter_strat_country.svg => age_scatter_strat_country.svg} (100%) rename tests/testthat/_snaps/autoplot.pop_data/{autoplot.pop_data_density.svg => density.svg} (100%) diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_no_strat.svg b/tests/testthat/_snaps/autoplot.pop_data/age_scatter_no_strat.svg similarity index 100% rename from tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_no_strat.svg rename to tests/testthat/_snaps/autoplot.pop_data/age_scatter_no_strat.svg diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_strat_country.svg b/tests/testthat/_snaps/autoplot.pop_data/age_scatter_strat_country.svg similarity index 100% rename from tests/testthat/_snaps/autoplot.pop_data/autoplot_pop_data_age_scatter_strat_country.svg rename to tests/testthat/_snaps/autoplot.pop_data/age_scatter_strat_country.svg diff --git a/tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data_density.svg b/tests/testthat/_snaps/autoplot.pop_data/density.svg similarity index 100% rename from tests/testthat/_snaps/autoplot.pop_data/autoplot.pop_data_density.svg rename to tests/testthat/_snaps/autoplot.pop_data/density.svg From 7992a838bb7ad785e520a5f8be2a1201ab67adef Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 18:11:48 -0700 Subject: [PATCH 16/48] updating snaps --- DESCRIPTION | 3 +- ..._no_strat.svg => age-scatter-no-strat.svg} | 6775 ++++++++-------- ...ntry.svg => age-scatter-strat-country.svg} | 6807 ++++++++--------- .../_snaps/autoplot.pop_data/density.svg | 253 +- tests/testthat/test-autoplot.pop_data.R | 24 +- 5 files changed, 6918 insertions(+), 6944 deletions(-) rename tests/testthat/_snaps/autoplot.pop_data/{age_scatter_no_strat.svg => age-scatter-no-strat.svg} (55%) rename tests/testthat/_snaps/autoplot.pop_data/{age_scatter_strat_country.svg => age-scatter-strat-country.svg} (53%) diff --git a/DESCRIPTION b/DESCRIPTION index 6ae449e3..b759d7f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -45,7 +45,8 @@ Suggests: ggbeeswarm, DT, spelling, - svglite + svglite, + vdiffr LazyData: true Encoding: UTF-8 URL: https://github.com/UCD-SERG/serocalculator, https://ucd-serg.github.io/serocalculator/ diff --git a/tests/testthat/_snaps/autoplot.pop_data/age_scatter_no_strat.svg b/tests/testthat/_snaps/autoplot.pop_data/age-scatter-no-strat.svg similarity index 55% rename from tests/testthat/_snaps/autoplot.pop_data/age_scatter_no_strat.svg rename to tests/testthat/_snaps/autoplot.pop_data/age-scatter-no-strat.svg index f81e3761..11409cfc 100644 --- a/tests/testthat/_snaps/autoplot.pop_data/age_scatter_no_strat.svg +++ b/tests/testthat/_snaps/autoplot.pop_data/age-scatter-no-strat.svg @@ -1,5 +1,5 @@ - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.0 -0.1 -1.0 -10.0 - - - - - - - - - - -0 -5 -10 -15 -20 -25 -Age -Antibody Response Value -Quantitative Antibody Responses by Age + +0.0 +0.1 +1.0 +10.0 + + + + + + + + + + +0 +5 +10 +15 +20 +25 +Age +Antibody Response Value +Quantitative Antibody Responses by Age diff --git a/tests/testthat/_snaps/autoplot.pop_data/age_scatter_strat_country.svg b/tests/testthat/_snaps/autoplot.pop_data/age-scatter-strat-country.svg similarity index 53% rename from tests/testthat/_snaps/autoplot.pop_data/age_scatter_strat_country.svg rename to tests/testthat/_snaps/autoplot.pop_data/age-scatter-strat-country.svg index 1a356ca0..f9c0b8fc 100644 --- a/tests/testthat/_snaps/autoplot.pop_data/age_scatter_strat_country.svg +++ b/tests/testthat/_snaps/autoplot.pop_data/age-scatter-strat-country.svg @@ -1,5 +1,5 @@ - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.0 -0.1 -1.0 -10.0 - - - - - - - - - - -0 -5 -10 -15 -20 -25 -Age -Antibody Response Value - -Country - - - - - - - - - -Bangladesh -Nepal -Pakistan -Quantitative Antibody Responses by Age + +0.0 +0.1 +1.0 +10.0 + + + + + + + + + + +0 +5 +10 +15 +20 +25 +Age +Antibody Response Value + +Country + + + + + + + + + +Bangladesh +Nepal +Pakistan +Quantitative Antibody Responses by Age diff --git a/tests/testthat/_snaps/autoplot.pop_data/density.svg b/tests/testthat/_snaps/autoplot.pop_data/density.svg index fed3c9cf..ac954af4 100644 --- a/tests/testthat/_snaps/autoplot.pop_data/density.svg +++ b/tests/testthat/_snaps/autoplot.pop_data/density.svg @@ -1,5 +1,5 @@ - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - -HlyE_IgG + + +HlyE_IgG - + - - + + - - -HlyE_IgA + + +HlyE_IgA - - - - - - -0 -50 -100 -150 -200 -0.0 -0.1 -0.2 -0.3 -0.4 - - - - - -0.0 -0.1 -0.2 -0.3 -0.4 - - - - - -Antibody Response Value -Frequency - -Country - - - - - - -Bangladesh -Nepal -Pakistan -Distribution of Cross-sectional Antibody Responses + + + + + + +0 +50 +100 +150 +200 +0.0 +0.1 +0.2 +0.3 +0.4 + + + + + +0.0 +0.1 +0.2 +0.3 +0.4 + + + + + +Antibody Response Value +Frequency + +Country + + + + + + +Bangladesh +Nepal +Pakistan +Distribution of Cross-sectional Antibody Responses diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index ce3766d3..f66f053d 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -36,13 +36,7 @@ test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`" standardize = TRUE ) %>% autoplot(strata = "Country", type = "density") %>% - ggplot2::ggsave( - filename = tempfile(), - device = "svg", - width = 8, - height = 8 - ) %>% - expect_snapshot_file(name = "density.svg") + vdiffr::expect_doppelganger(title = "density") }) test_that("`autoplot.pop_data()` produces stable results for @@ -56,13 +50,7 @@ test_that("`autoplot.pop_data()` produces stable results for standardize = TRUE ) %>% autoplot(strata = "Country", type = "age-scatter") %>% - ggplot2::ggsave( - filename = tempfile(), - device = "svg", - width = 8, - height = 8 - ) %>% - expect_snapshot_file(name = "age_scatter_strat_country.svg") + vdiffr::expect_doppelganger(title = "age_scatter_strat_country") }) test_that("`autoplot.pop_data()` produces stable results @@ -76,11 +64,5 @@ test_that("`autoplot.pop_data()` produces stable results standardize = TRUE ) %>% autoplot(strata = NULL, type = "age-scatter") %>% - ggplot2::ggsave( - filename = tempfile(), - device = "svg", - width = 8, - height = 8 - ) %>% - expect_snapshot_file(name = "age_scatter_no_strat.svg") + vdiffr::expect_doppelganger(title = "age_scatter_no_strat") }) From 243b56e6c430a750f2a8b135f5bf5bd3320a12c2 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 22:11:18 -0700 Subject: [PATCH 17/48] skip test on oldrel --- R/autoplot.pop_data.R | 6 ++++-- tests/testthat/test-autoplot.pop_data.R | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/R/autoplot.pop_data.R b/R/autoplot.pop_data.R index e4e7bbd7..87d9cf50 100644 --- a/R/autoplot.pop_data.R +++ b/R/autoplot.pop_data.R @@ -118,10 +118,12 @@ age_scatter <- function( density_plot <- function( object, strata = NULL, - log = FALSE) { + log = FALSE, + value_var = object %>% get_value_var()) { plot1 <- object %>% - ggplot2::ggplot(ggplot2::aes(x = .data[[object %>% get_value_var()]])) + + ggplot2::ggplot() + + ggplot2::aes(x = .data[[value_var]]) + ggplot2::theme_linedraw() + ggplot2::facet_wrap(~antigen_iso, nrow = 3) diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index f66f053d..49aa24e9 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -28,6 +28,7 @@ test_that("`autoplot.pop_data()` raise test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`", { + skip_if(getRversion() < "4.4.1") xs_data <- load_pop_data( file_path = "https://osf.io/download//n6cp3/", age = "Age", @@ -42,6 +43,7 @@ test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`" test_that("`autoplot.pop_data()` produces stable results for `type = 'age-scatter'`", { + xs_data <- load_pop_data( file_path = "https://osf.io/download//n6cp3/", age = "Age", @@ -54,7 +56,7 @@ test_that("`autoplot.pop_data()` produces stable results for }) test_that("`autoplot.pop_data()` produces stable results - for `type = 'age-scatter' no strat`", + for `type = 'age-scatter', strata = NULL`", { xs_data <- load_pop_data( file_path = "https://osf.io/download//n6cp3/", From c840c69d2f3b123e5cb80e4a00810e582cea3b65 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 23 Sep 2024 22:12:03 -0700 Subject: [PATCH 18/48] comment --- tests/testthat/test-autoplot.pop_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index 49aa24e9..299e951a 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -28,7 +28,7 @@ test_that("`autoplot.pop_data()` raise test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`", { - skip_if(getRversion() < "4.4.1") + skip_if(getRversion() < "4.4.1") # 4.3.3 had issues xs_data <- load_pop_data( file_path = "https://osf.io/download//n6cp3/", age = "Age", From f0011045f0b97b47d0c79cdcba9de8bd6a385978 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 10:36:11 +0300 Subject: [PATCH 19/48] make requested changes --- vignettes/articles/scrubTyphus_example.Rmd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index 28369609..d4b8c1a7 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -43,12 +43,17 @@ knitr::opts_chunk$set( ### Load packages -The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. +The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. +```{r setup, message=FALSE} +devtools::install_github("ucd-serg/serocalculator", eval=FALSE) +``` ```{r load_packages} library(serocalculator) +install.packages("tidyverse", eval=FALSE) library(tidyverse) +install.packages("mixtools", eval=FALSE) library(mixtools) ``` @@ -240,10 +245,10 @@ estdf <- summary(est) %>% est2df <- summary(est2) -est.comb <- rbind(estdf, est2df) +est_comb <- rbind(estdf, est2df) # Create barplot (rescale incidence rate and CIs) -ggplot(est.comb, aes(y = ageQ, x = incidence.rate * 1000, fill = country)) + +ggplot(est_comb, aes(y = ageQ, x = incidence.rate * 1000, fill = country)) + geom_bar( stat = "identity", position = position_dodge2(width = 0.8, preserve = "single") From 4caf35ca039aed973a8722a85972a369a4428e98 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 18:28:12 +0300 Subject: [PATCH 20/48] make requested changes --- vignettes/articles/scrubTyphus_example.Rmd | 1 + 1 file changed, 1 insertion(+) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index d4b8c1a7..f937fe6f 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -51,6 +51,7 @@ devtools::install_github("ucd-serg/serocalculator", eval=FALSE) ```{r load_packages} library(serocalculator) +library(devtools) install.packages("tidyverse", eval=FALSE) library(tidyverse) install.packages("mixtools", eval=FALSE) From 470b6b9e00c72f90413622e44e53b1e5944e3625 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 22:04:14 +0300 Subject: [PATCH 21/48] shift code position to avoid devtools error --- vignettes/articles/scrubTyphus_example.Rmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index f937fe6f..14de5448 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -45,10 +45,6 @@ knitr::opts_chunk$set( ### Load packages The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. -```{r setup, message=FALSE} -devtools::install_github("ucd-serg/serocalculator", eval=FALSE) -``` - ```{r load_packages} library(serocalculator) library(devtools) @@ -58,6 +54,10 @@ install.packages("mixtools", eval=FALSE) library(mixtools) ``` +```{r setup, message=FALSE} +devtools::install_github("ucd-serg/serocalculator", eval=FALSE) +``` + ### Load data Pathogen-specific sample datasets, noise parameters, and longitudinal antibody dynamics for **serocalculator** are available on the [Serocalculator Repository](https://osf.io/ne8pc/) on Open Science Framework (OSF). We will pull this data directly into our R environment. From db0dffa6410137b4aeab2092c84ca461f5280765 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 22:35:13 +0300 Subject: [PATCH 22/48] remove eval from installation --- vignettes/articles/scrubTyphus_example.Rmd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index 14de5448..dc81f57c 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -42,6 +42,11 @@ knitr::opts_chunk$set( ``` +```{r setup, message=FALSE} +devtools::install_github("ucd-serg/serocalculator", eval=FALSE) +``` + + ### Load packages The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. @@ -54,9 +59,6 @@ install.packages("mixtools", eval=FALSE) library(mixtools) ``` -```{r setup, message=FALSE} -devtools::install_github("ucd-serg/serocalculator", eval=FALSE) -``` ### Load data From c2d424da80a8af76047cca59bb3a66e36454b10f Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 22:43:12 +0300 Subject: [PATCH 23/48] install devtools --- vignettes/articles/scrubTyphus_example.Rmd | 1 + 1 file changed, 1 insertion(+) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index dc81f57c..ea26466e 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -43,6 +43,7 @@ knitr::opts_chunk$set( ```{r setup, message=FALSE} +install.packages("devtools") devtools::install_github("ucd-serg/serocalculator", eval=FALSE) ``` From 35c31e0c04532487ed3c3927dce20252c87d30d7 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 23:04:48 +0300 Subject: [PATCH 24/48] Increment version number to 1.2.0.9008 --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8aa4f25b..4a2403b7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: serocalculator Type: Package Title: Estimating Infection Rates from Serological Data -Version: 1.2.0.9007 +Version: 1.2.0.9008 Authors@R: c( person(given = "Peter", family = "Teunis", email = "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), person(given = "Kristina", family = "Lai", email = "kwlai@ucdavis.edu", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index af052946..03b40d53 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# serocalculator (development version) + # serocalculator 1.3.0 * Improve error communication for `autoplot.pop_data()` From 3c57a25ef8ee8eaa8a51c3f1767ee524e4fcc868 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 23:19:29 +0300 Subject: [PATCH 25/48] increment version --- NEWS.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 03b40d53..f0936428 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,5 @@ # serocalculator (development version) -# serocalculator 1.3.0 - -* Improve error communication for `autoplot.pop_data()` - ## New features * Added template for reporting Issues From 57eceb30d9e6992b8a90cf4ea239f4d29eee55d1 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 29 Sep 2024 23:32:34 +0300 Subject: [PATCH 26/48] add test documentation --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index f0936428..555f9293 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,8 @@ including: - lint changed files (#256) # serocalculator 1.2.0 +* Added `test-autoplot.pop_data` test + * Added `test-summary.pop_data` test * Modified `test-est.incidence` test From dd7f12fafa9e5157077353f1b16bd83ae32d4f17 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Fri, 4 Oct 2024 11:07:27 +0300 Subject: [PATCH 27/48] Increment version number to 1.2.0.9015 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 669cd35a..660c4412 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: serocalculator Title: Estimating Infection Rates from Serological Data -Version: 1.2.0.9014 +Version: 1.2.0.9015 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From 71c743f633fe5753587334e49ae7dbf32c94667b Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Sun, 6 Oct 2024 23:15:09 +0300 Subject: [PATCH 28/48] add library --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 660c4412..83930851 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -38,7 +38,8 @@ Imports: tibble, tidyr, tidyselect, - utils + utils, + vdiffr Suggests: bookdown, devtag (>= 0.0.0.9000), From 4d445f81133038b7649ed654f31536ed44d07b42 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Mon, 7 Oct 2024 00:00:37 +0300 Subject: [PATCH 29/48] add packages' --- DESCRIPTION | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 83930851..b6bcb486 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -39,7 +39,7 @@ Imports: tidyr, tidyselect, utils, - vdiffr + purrr Suggests: bookdown, devtag (>= 0.0.0.9000), @@ -56,7 +56,9 @@ Suggests: ssdtools (>= 1.0.6.9016), testthat (>= 3.0.0), tidyverse, - qrcode + qrcode, + svglite, + vdiffr LinkingTo: Rcpp Config/testthat/edition: 3 From 7ef83380f15b143567e2d7b1784b257bd316ee45 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Mon, 7 Oct 2024 05:42:23 +0300 Subject: [PATCH 30/48] linting --- R/autoplot.pop_data.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/autoplot.pop_data.R b/R/autoplot.pop_data.R index 87d9cf50..786207de 100644 --- a/R/autoplot.pop_data.R +++ b/R/autoplot.pop_data.R @@ -55,7 +55,8 @@ autoplot.pop_data <- function( message = c( x = "{.fn autoplot.pop_data} does not currently have an option for {.arg type} = {.str {type}}.", - i = "The {.arg type} argument accepts options {.str density} or {.str age-scatter}." + i = "The {.arg type} argument accepts options + {.str density} or {.str age-scatter}." ) ) } From 399fdf4a34e3b49b95f77f557a318e98a65f0198 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Mon, 7 Oct 2024 07:24:58 +0300 Subject: [PATCH 31/48] linting --- tests/testthat/test-autoplot.pop_data.R | 3 ++- vignettes/articles/scrubTyphus_example.Rmd | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-autoplot.pop_data.R b/tests/testthat/test-autoplot.pop_data.R index 299e951a..1c3c649a 100644 --- a/tests/testthat/test-autoplot.pop_data.R +++ b/tests/testthat/test-autoplot.pop_data.R @@ -26,7 +26,8 @@ test_that("`autoplot.pop_data()` raise autoplot(strata = "strat1", type = "density")) }) -test_that("`autoplot.pop_data()` produces stable results for `type = 'density'`", +test_that("`autoplot.pop_data()` produces + stable results for `type = 'density'`", { skip_if(getRversion() < "4.4.1") # 4.3.3 had issues xs_data <- load_pop_data( diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index 35327491..b7696a88 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -43,7 +43,7 @@ knitr::opts_chunk$set( ```{r setup, message=FALSE} install.packages("devtools") -devtools::install_github("ucd-serg/serocalculator", eval=FALSE) +devtools::install_github("ucd-serg/serocalculator", eval = FALSE) ``` @@ -53,9 +53,9 @@ The first step in conducting this analysis is to load our necessary packages. If ```{r load_packages} library(serocalculator) library(devtools) -install.packages("tidyverse", eval=FALSE) +install.packages("tidyverse", eval = FALSE) library(tidyverse) -install.packages("mixtools", eval=FALSE) +install.packages("mixtools", eval = FALSE) library(mixtools) ``` @@ -151,7 +151,7 @@ Column Name | Description ```{r message=FALSE, warning=FALSE} # biologic noise -b.noise <- xs_data %>% +b_noise <- xs_data %>% group_by(antigen_iso) %>% filter(!is.na(value)) %>% filter(age < 40) %>% # restrict to young ages to capture recent exposures @@ -181,7 +181,7 @@ b.noise <- xs_data %>% # define conditional parameters noise <- data.frame( antigen_iso = c("OT56kda_IgG", "OT56kda_IgM"), - nu = as.numeric(c(b.noise[2, 2], b.noise[1, 2])), # Biologic noise (nu) + nu = as.numeric(c(b_noise[2, 2], b_noise[1, 2])), # Biologic noise (nu) eps = c(0.2, 0.2), # M noise (eps) y.low = c(0.2, 0.2), # low cutoff (llod) y.high = c(200, 200) From a3f53a0137b2b259daebe8ec49cdaedbf817fcb8 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 7 Oct 2024 01:33:16 -0700 Subject: [PATCH 32/48] edits to `NEWS.md` --- NEWS.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a6f49dde..980184ab 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ ## New features +* Improved error messaging for `autoplot.pop_data()` + * Updated `simulate_xsectionalData.Rmd()` (linting, removing deprecated functions). * Added default value for `antigen_isos` argument in `log_likelihood()` (#286) @@ -18,6 +20,8 @@ ## Developer-facing changes +* Added `test-autoplot.pop_data` test (#234) + * initialized [`lintr`](https://lintr.r-lib.org/) with `lintr::use_lint()` (#278) * created unit test for `df_to_array()` (#276) @@ -44,7 +48,6 @@ including: - lint changed files (#256) # serocalculator 1.2.0 -* Added `test-autoplot.pop_data` test * Added `test-summary.pop_data` test From 01c30b92b213800cd79694e7d181cfc1ce6d501f Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 7 Oct 2024 01:42:51 -0700 Subject: [PATCH 33/48] simplify installation instructions --- vignettes/articles/scrubTyphus_example.Rmd | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index b7696a88..0684f007 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -40,26 +40,23 @@ knitr::opts_chunk$set( ) ``` - -```{r setup, message=FALSE} -install.packages("devtools") -devtools::install_github("ucd-serg/serocalculator", eval = FALSE) -``` - - ### Load packages -The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. +The first step in conducting this analysis is to load our necessary packages. +If you haven't installed already, you will need to do so before loading. +We will also need to have the `{tidyverse}` packages installed +for data manipulation and graphics. +Please see the [`serocalculator` installation instructions](https://ucd-serg.github.io/serocalculator/#installing-the-serocalculator-package) +for more details on installing `{serocalculator}`, +and see the [`tidyverse` installation instructions](https://tidyverse.tidyverse.org/#installation) +for more details on installing `{tidyverse}`. + +Once those packages are installed, load them: ```{r load_packages} library(serocalculator) -library(devtools) -install.packages("tidyverse", eval = FALSE) library(tidyverse) -install.packages("mixtools", eval = FALSE) -library(mixtools) ``` - ### Load data Pathogen-specific sample datasets, noise parameters, and longitudinal antibody dynamics for **serocalculator** are available on the [Serocalculator Repository](https://osf.io/ne8pc/) on Open Science Framework (OSF). We will pull this data directly into our R environment. From bad68150e59aeac14672150708880a0bf6392343 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 7 Oct 2024 01:47:51 -0700 Subject: [PATCH 34/48] simplifying installation instructions --- vignettes/articles/scrubTyphus_example.Rmd | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index 0684f007..cb22d563 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -43,18 +43,21 @@ knitr::opts_chunk$set( ### Load packages The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. -We will also need to have the `{tidyverse}` packages installed -for data manipulation and graphics. -Please see the [`serocalculator` installation instructions](https://ucd-serg.github.io/serocalculator/#installing-the-serocalculator-package) -for more details on installing `{serocalculator}`, -and see the [`tidyverse` installation instructions](https://tidyverse.tidyverse.org/#installation) -for more details on installing `{tidyverse}`. +We will also need to have the `{tidyverse}` and `{mixtools}` packages installed +for data manipulation and graphics operations we will perform in this vignette. +Please see the websites for +[`{serocalculator}](https://ucd-serg.github.io/serocalculator/#installing-the-serocalculator-package), +[`{tidyverse}`](https://tidyverse.tidyverse.org/#installation), +and [`{mixtools}`](https://github.com/dsy109/mixtools?tab=readme-ov-file#installation) +for guidance on installing these packages into your R package library. -Once those packages are installed, load them: +Once all three of those packages are installed, we can load them into +our active R session environment: ```{r load_packages} library(serocalculator) library(tidyverse) +library(mixtools) ``` ### Load data From 2d505c67d4fd66537db1deb9829b19f098a58e87 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 7 Oct 2024 01:48:27 -0700 Subject: [PATCH 35/48] added missing backtick --- vignettes/articles/scrubTyphus_example.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index cb22d563..5c462822 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -46,7 +46,7 @@ If you haven't installed already, you will need to do so before loading. We will also need to have the `{tidyverse}` and `{mixtools}` packages installed for data manipulation and graphics operations we will perform in this vignette. Please see the websites for -[`{serocalculator}](https://ucd-serg.github.io/serocalculator/#installing-the-serocalculator-package), +[`{serocalculator}`](https://ucd-serg.github.io/serocalculator/#installing-the-serocalculator-package), [`{tidyverse}`](https://tidyverse.tidyverse.org/#installation), and [`{mixtools}`](https://github.com/dsy109/mixtools?tab=readme-ov-file#installation) for guidance on installing these packages into your R package library. From 3c024661e215552e1f183e5b64d40238d44713cf Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 7 Oct 2024 01:52:58 -0700 Subject: [PATCH 36/48] added to changelog --- NEWS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 980184ab..86d252a8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,9 @@ ## New features -* Improved error messaging for `autoplot.pop_data()` +* Improved error messaging for `autoplot.pop_data()` (#234). + +* Clarified package installation instructions in scrub typhus vignette (#234). * Updated `simulate_xsectionalData.Rmd()` (linting, removing deprecated functions). From ba731ac7d6391e81f157ad9813648d2112892f95 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 7 Oct 2024 01:59:00 -0700 Subject: [PATCH 37/48] remove brackets which seemed not to work well --- vignettes/articles/scrubTyphus_example.Rmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vignettes/articles/scrubTyphus_example.Rmd b/vignettes/articles/scrubTyphus_example.Rmd index 5c462822..6a76363e 100644 --- a/vignettes/articles/scrubTyphus_example.Rmd +++ b/vignettes/articles/scrubTyphus_example.Rmd @@ -43,12 +43,12 @@ knitr::opts_chunk$set( ### Load packages The first step in conducting this analysis is to load our necessary packages. If you haven't installed already, you will need to do so before loading. -We will also need to have the `{tidyverse}` and `{mixtools}` packages installed +We will also need to have the `tidyverse` and `mixtools` packages installed for data manipulation and graphics operations we will perform in this vignette. Please see the websites for -[`{serocalculator}`](https://ucd-serg.github.io/serocalculator/#installing-the-serocalculator-package), -[`{tidyverse}`](https://tidyverse.tidyverse.org/#installation), -and [`{mixtools}`](https://github.com/dsy109/mixtools?tab=readme-ov-file#installation) +[`serocalculator`](https://ucd-serg.github.io/serocalculator/#installing-the-serocalculator-package), +[`tidyverse`](https://tidyverse.tidyverse.org/#installation), +and [`mixtools`](https://github.com/dsy109/mixtools?tab=readme-ov-file#installation) for guidance on installing these packages into your R package library. Once all three of those packages are installed, we can load them into From 8d6d9099aefbed267af5666e33f9b2d41d19c271 Mon Sep 17 00:00:00 2001 From: Chris Orwa Date: Tue, 8 Oct 2024 18:51:04 +0300 Subject: [PATCH 38/48] Increment version number to 1.2.0.9017 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index ff004b3b..25ae8c80 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: serocalculator Title: Estimating Infection Rates from Serological Data -Version: 1.2.0.9016 +Version: 1.2.0.9017 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From e537fc646fc41f75ceb293aeb2980a64d12c993b Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 16:59:59 -0700 Subject: [PATCH 39/48] - switched to pkgdown workflow from https://github.com/rstudio/education-workflows/blob/main/examples/pkgdown.yaml --- .github/workflows/pkgdown.yaml | 150 +++++++++++++++++++++++++++------ 1 file changed, 125 insertions(+), 25 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 12811eec..f1e8c137 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,28 +1,54 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +# Deploys pkgdown for Pull Requests, tags, and pushes to main branch +# PRs are deployed to /preview/pr/ +# Tags are deployed to // +# copied from https://github.com/rstudio/education-workflows/blob/main/examples/pkgdown.yaml +# referred from https://github.com/r-lib/actions/issues/865 on: - push: - branches: [main, master] pull_request: - branches: [main, master] - release: - types: [published] + branches: + - main + types: + - opened + - reopened + - synchronize + - closed + paths: + - 'man/**' + - 'pkgdown/**' + - 'vignettes/**' + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' # build on version tags + - '!v[0-9]+.[0-9]+.[0-9]+.[0-9]+' # but not if version involves a dev component + branches: + - main workflow_dispatch: + inputs: + tag: + description: Tag to deploy + required: true + default: '' -name: pkgdown.yaml +name: pkgdown jobs: - pkgdown: + pkgdown-build: runs-on: ubuntu-latest - # Only restrict concurrency for non-PR jobs - concurrency: - group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + if: ${{ !(github.event_name == 'pull_request' && github.event.action == 'closed') }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - permissions: - contents: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 + + - name: Configure git + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - uses: r-lib/actions/pr-fetch@v2 + if: ${{ github.event_name == 'pull_request' }} + with: + repo-token: ${{ github.token }} - uses: r-lib/actions/setup-pandoc@v2 @@ -32,17 +58,91 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::pkgdown, local::. - needs: website + needs: | + connect + website + extra-packages: | + local::. + any::pkgdown + + # If events is a PR, set subdir to 'preview/pr' + - name: "[PR] Set documentation subdirectory" + if: github.event_name == 'pull_request' + run: | + echo "PKGDOWN_DEV_MODE=unreleased" >> $GITHUB_ENV + echo "subdir=preview/pr${{ github.event.number }}" >> $GITHUB_ENV - - name: Build site - run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + # If event is a tag, set subdir to '' + - name: "[tag] Set documentation subdirectory" + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + run: | + echo "PKGDOWN_DEV_MODE=release" >> $GITHUB_ENV + echo "subdir=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + # If event is workflow_dispatch, set subdir to 'inputs.tag' + - name: '[dispatch] Set documentation subdirectory' + if: github.event_name == 'workflow_dispatch' + run: | + echo "subdir=${{ github.event.inputs.tag }}" >> $GITHUB_ENV + + - name: Deploy pkgdown site + id: deploy shell: Rscript {0} + run: | + subdir <- "${{ env.subdir }}" + pkg <- pkgdown::as_pkgdown(".") + + # Deploy pkgdown site to branch + pkgdown::deploy_to_branch(subdir = if (nzchar(subdir)) subdir, clean = nzchar(subdir)) + + # Report deployed site URL + deployed_url <- file.path(pkg$meta$url, subdir) + cat(sprintf('url=%s', deployed_url), file = Sys.getenv("GITHUB_OUTPUT"), append = TRUE) + + - name: Notify pkgdown deployment + if: github.event_name == 'pull_request' + uses: hasura/comment-progress@v2.2.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + number: ${{ github.event.number }} + id: pkgdown-deploy + append: false + message: > + :book: ${{ steps.deploy.outputs.url }} + + Preview documentation for this PR (at commit ${{ github.event.pull_request.head.sha }}) + + pkgdown-clean: + if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }} + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + ref: "gh-pages" + + - name: Clean up PR Preview + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + + preview_dir="preview/pr${{ github.event.pull_request.number }}" + if [ -d "$preview_dir" ]; then + git rm -r $preview_dir + git commit -m "Remove $preview_dir (GitHub Actions)" || echo 'No preview to remove' + git push origin || echo 'No preview to remove' + else + echo 'No preview to remove' + fi - - name: Deploy to GitHub pages 🚀 - if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.5.0 + - name: Notify pkgdown cleanup + uses: hasura/comment-progress@v2.2.0 with: - clean: false - branch: gh-pages - folder: docs + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + number: ${{ github.event.number }} + id: pkgdown-deploy + message: | + _:closed_book: Preview documentation for this PR has been cleaned up._ From ce8c36834542c646d453801de75b89804180d2ab Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 17:08:17 -0700 Subject: [PATCH 40/48] test formatting --- vignettes/articles/enteric_fever_example.Rmd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vignettes/articles/enteric_fever_example.Rmd b/vignettes/articles/enteric_fever_example.Rmd index b7934dcb..057735bd 100644 --- a/vignettes/articles/enteric_fever_example.Rmd +++ b/vignettes/articles/enteric_fever_example.Rmd @@ -13,7 +13,12 @@ bibliography: ../references.bib --- ## Introduction -This vignette provides users with an example analysis using the [**serocalculator**](https://github.com/UCD-SERG/serocalculator) package by reproducing the analysis for: [**Estimating typhoid incidence from community-based serosurveys: a multicohort study**](https://www.thelancet.com/journals/lanmic/article/PIIS2666-5247(22)00114-8/fulltext) (@Aiemjoy_2022_Lancet). We review the methods underlying the analysis and then walk through an example of enteric fever incidence in Pakistan. Note that because this is a simplified version of the analysis, the results here will differ slightly from those presented in the publication. +This vignette provides users with an example analysis using the [**serocalculator**](https://github.com/UCD-SERG/serocalculator) package +by reproducing the analysis for: +[**Estimating typhoid incidence from community-based serosurveys: a multicohort study**](https://www.thelancet.com/journals/lanmic/article/PIIS2666-5247(22)00114-8/fulltext) (@Aiemjoy_2022_Lancet). +We review the methods underlying the analysis +and then walk through an example of enteric fever incidence in Pakistan. +Note that because this is a simplified version of the analysis, the results here will differ slightly from those presented in the publication. In this example, users will determine the seroincidence of enteric fever in cross-sectional serosurveys conducted as part of the SeroEpidemiology and Environmental Surveillance (SEES) for enteric fever study in Bangladesh, Nepal, and Pakistan. Longitudinal antibody responses were modeled from 1420 blood culture-confirmed enteric fever cases enrolled from the same countries. From ff6366458eb0655c4b09df5abf0f4acee25c7108 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 17:20:36 -0700 Subject: [PATCH 41/48] Increment version number to 1.2.0.9017 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index cd89fe11..21eeb85e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: serocalculator Title: Estimating Infection Rates from Serological Data -Version: 1.2.0.9016 +Version: 1.2.0.9017 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From 73f3bc39130f9998fce9128b853d3cc4e850ccae Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 17:21:40 -0700 Subject: [PATCH 42/48] updated news --- NEWS.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 4abcd819..c5afce88 100644 --- a/NEWS.md +++ b/NEWS.md @@ -19,7 +19,9 @@ * Added template for pull requests (from ) (#265) -## Developer-facing changes +## Internal changes + +* Added online preview builds for PRs that change the `pkgdown` website (#309) * initialized [`lintr`](https://lintr.r-lib.org/) with `lintr::use_lint()` (#278) @@ -28,6 +30,7 @@ * fixed `dplyr::select()` deprecation warning in `df_to_array()` (#276) * Added `devtag` to package (using `devtag::use_devtag()`) (#292) + * Added `@dev` tag to `?df_to_array()` (#292) * Generalized `get_()` and `set_()` methods to be general-purpose From d96c630bc2369338837675d0b0372b37df2fae8e Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 17:25:22 -0700 Subject: [PATCH 43/48] - updated wordlist --- inst/WORDLIST | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/inst/WORDLIST b/inst/WORDLIST index f03a07b0..ef8029da 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -53,6 +53,7 @@ Nadu OSF Orientia PLoS +PRs Pebody Polina RStudio @@ -84,9 +85,6 @@ Valk Vectorized Vellore Versteegh -VignetteEncoding -VignetteEngine -VignetteIndexEntry Volterra Wetering Wiens @@ -97,7 +95,6 @@ behaviour bioassays biomarker boldsymbol -bookdown callout campylobacteriosis cdot @@ -125,7 +122,6 @@ isotypes jinf jitter kDa -knitr le leq llik @@ -155,7 +151,6 @@ qquad recombinant renewcommand rescale -rmarkdown savePath sectionally sera @@ -178,11 +173,9 @@ subfigures th tibble titers -toc tsutsugamushi undercount unstratified varepsilon vec vee -xsectionalData From 265b9d8616a99376cabdc39ce2e0d5c841581fc2 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 17:50:04 -0700 Subject: [PATCH 44/48] - disabled search indexing within the preview subdirectories (see https://github.com/rstudio/education-workflows/tree/main/examples) --- _pkgdown.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/_pkgdown.yml b/_pkgdown.yml index e837b2fc..f41dd17c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -4,3 +4,6 @@ template: light-switch: true bibliography: vignettes/references.bib + +search: + exclude: ['preview/'] From 5102c8ff90bfbfd3acba430aa2d6f0afaf0c29b2 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 18:30:43 -0700 Subject: [PATCH 45/48] Increment version number to 1.2.0.9018 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 25ae8c80..a059428a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: serocalculator Title: Estimating Infection Rates from Serological Data -Version: 1.2.0.9017 +Version: 1.2.0.9018 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From 203b3e037f755dd8171eef21d691cab07e150350 Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 18:34:24 -0700 Subject: [PATCH 46/48] removed redundant changelog line --- NEWS.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 47ba5879..f44dc870 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,8 +5,6 @@ * Clarified package installation instructions in scrub typhus vignette (#234). -* Updated `simulate_xsectionalData.Rmd()` (linting, removing deprecated functions). - * Add `as_noise_params` (#228) * Updated `simulate_xsectionalData.Rmd` (linting, removing deprecated functions) (#289) From a2a776074121592c65d2e91f67e58696ccbd6cca Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 18:34:50 -0700 Subject: [PATCH 47/48] reverted change --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index f44dc870..b7c05b92 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,7 +7,8 @@ * Add `as_noise_params` (#228) -* Updated `simulate_xsectionalData.Rmd` (linting, removing deprecated functions) (#289) +* Updated `simulate_xsectionalData.Rmd` (linting, removing deprecated functions) +(#289) * Added default value for `antigen_isos` argument in `log_likelihood()` (#286) From a58657f9b19acf095a4bd7085bd10c0c38538e9c Mon Sep 17 00:00:00 2001 From: Douglas Ezra Morrison Date: Mon, 14 Oct 2024 18:35:49 -0700 Subject: [PATCH 48/48] removed unnecessarily added space --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b7c05b92..87839e24 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,7 +7,7 @@ * Add `as_noise_params` (#228) -* Updated `simulate_xsectionalData.Rmd` (linting, removing deprecated functions) +* Updated `simulate_xsectionalData.Rmd` (linting, removing deprecated functions) (#289) * Added default value for `antigen_isos` argument in `log_likelihood()` (#286)