From aea299ac4a3bd9453a769c48f455dddd66f8f3a4 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 24 Jun 2025 22:48:00 -0700 Subject: [PATCH 01/53] Adding class sero_mod_output to run_mod output --- R/Run_Mod.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/Run_Mod.R b/R/Run_Mod.R index 98e904c3..78310318 100644 --- a/R/Run_Mod.R +++ b/R/Run_Mod.R @@ -196,4 +196,6 @@ run_mod <- function(data, structure(jags.post = jags_post_final) } jags_out + class(jags_out) <- "sero_mod_output" + } From a13db942c5e590e8fabf26a64426da37d6b51424 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 24 Jun 2025 23:21:27 -0700 Subject: [PATCH 02/53] Specifying class in run_mod --- R/Run_Mod.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/Run_Mod.R b/R/Run_Mod.R index 78310318..2f0ed78f 100644 --- a/R/Run_Mod.R +++ b/R/Run_Mod.R @@ -195,7 +195,7 @@ run_mod <- function(data, jags_out <- jags_out |> structure(jags.post = jags_post_final) } - jags_out class(jags_out) <- "sero_mod_output" + jags_out } From eef3d8ed527cbef310098b7b06c386e1910e871d Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 24 Jun 2025 23:21:53 -0700 Subject: [PATCH 03/53] creating default print function method for sero_mod_output objects --- R/print_sero_mod_output.R | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 R/print_sero_mod_output.R diff --git a/R/print_sero_mod_output.R b/R/print_sero_mod_output.R new file mode 100644 index 00000000..dc950058 --- /dev/null +++ b/R/print_sero_mod_output.R @@ -0,0 +1,32 @@ +#' @title Default print method for run_mod output +#' @author Sam Schildhauer +#' @description +#' Will print a default output for a run_mod object that specifies the median +#' value of the posterior distribution for serokinetic curve parameters (y0, +#' y1, t1, alpha, shape) by stratification (if specified) and antigen/iso type. +#' @param obj A [serodynamics::sero_mod_output] object. +#' @returns A [dplyr::tbl_df] that contains the median value of the posterior +#' distribution of stratifications (if any specified), antigen/iso type, and +#' parameter value. +#' @export +#' @example inst/examples/run_mod-examples.R + +print.sero_mod_output <- function(obj) { + + # Summarizing results + df_obj <- data.frame("Parameter" = obj$Parameter, "Iso_type" = obj$Iso_type, + "Stratification" = obj$Stratification, + "Value" = obj$value) + if (unique(df_obj$Stratification == "None")) { + to_print <- df_obj |> + dplyr::group_by(Iso_type, Parameter) |> + dplyr::summarize(median = median(Value)) |> + tidyr::spread(Parameter, median) + } else { + to_print <- df_obj |> + dplyr::group_by(Stratification, Iso_type, Parameter) |> + dplyr::summarize(median = median(Value)) |> + tidyr::spread(Parameter, median) + } + to_print +} From 147ae9ec1e9b240dd2f2563c3f43ddc8b9f14036 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 24 Jun 2025 23:22:53 -0700 Subject: [PATCH 04/53] Adding S3 method to NameSpace --- NAMESPACE | 1 + 1 file changed, 1 insertion(+) diff --git a/NAMESPACE b/NAMESPACE index 09e6f3bd..022010b0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand S3method(autoplot,case_data) +S3method(print,sero_mod_output) export(as_case_data) export(autoplot) export(get_biomarker_levels) From ea74517c908b6c366c07dfe0e9fc96011be284a7 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 24 Jun 2025 23:23:07 -0700 Subject: [PATCH 05/53] Documentation for default print method --- man/print.sero_mod_output.Rd | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 man/print.sero_mod_output.Rd diff --git a/man/print.sero_mod_output.Rd b/man/print.sero_mod_output.Rd new file mode 100644 index 00000000..0dd8540f --- /dev/null +++ b/man/print.sero_mod_output.Rd @@ -0,0 +1,50 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/print_sero_mod_output.R +\name{print.sero_mod_output} +\alias{print.sero_mod_output} +\title{Default print method for run_mod output} +\usage{ +\method{print}{sero_mod_output}(obj) +} +\arguments{ +\item{obj}{A \link{sero_mod_output} object.} +} +\value{ +A \link[dplyr:tbl_df]{dplyr::tbl_df} that contains the median value of the posterior +distribution of stratifications (if any specified), antigen/iso type, and +parameter value. +} +\description{ +Will print a default output for a run_mod object that specifies the median +value of the posterior distribution for serokinetic curve parameters (y0, +y1, t1, alpha, shape) by stratification (if specified) and antigen/iso type. +} +\examples{ +if (!is.element(runjags::findjags(), c("", NULL))) { + library(runjags) + set.seed(1) + library(dplyr) + strat1 <- serocalculator::typhoid_curves_nostrat_100 |> + sim_case_data(n = 100) |> + mutate(strat = "stratum 2") + strat2 <- serocalculator::typhoid_curves_nostrat_100 |> + sim_case_data(n = 100) |> + mutate(strat = "stratum 1") + + dataset <- bind_rows(strat1, strat2) + + fitted_model <- run_mod( + data = dataset, # The data set input + file_mod = serodynamics_example("model.jags"), + nchain = 4, # Number of mcmc chains to run + nadapt = 100, # Number of adaptations to run + nburn = 100, # Number of unrecorded samples before sampling begins + nmc = 1000, + niter = 2000, # Number of iterations + strat = "strat" + ) # Variable to be stratified +} +} +\author{ +Sam Schildhauer +} From 102cb808b695691268eeb1622ada71c2cea46d97 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:12:24 -0700 Subject: [PATCH 06/53] Creating default print for run_mod objects --- R/print.sr_model.R | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 R/print.sr_model.R diff --git a/R/print.sr_model.R b/R/print.sr_model.R new file mode 100644 index 00000000..0ba453b6 --- /dev/null +++ b/R/print.sr_model.R @@ -0,0 +1,29 @@ +#' @title Default print for run_mod object of class sr_model +#' @author Sam Schildhauer +#' @description +#' A default print method for class `sr_model` that includes the mean posterior +#' distribution for antibody kinetic curve parameters by `Iso_type` and +#' `Stratification` (if specified). +#' @param data A [serodynamics::sr_model] object output from the +#' [serodynamics::run_mod()] function. +#' @returns A [dplyr::grouped_df] that +#' contains the mean posterior distribution for antibody kinetic curve +#' parameters by `Iso_type` and `Stratification` (if specified). +#' @export +#' @example +#' print.sr_model(nepal_sees_output) +print.sr_model <- function(data) { + data_group <- data |> + dplyr::group_by(Stratification, Iso_type, Parameter) |> + dplyr::summarise(mean_val = mean(value)) |> + tidyr::spread(Parameter, mean_val) + # Taking out stratification column if not specified + if(unique(data$Stratification == "None")) { + data_group <- data_group[,2:7] + } + data_group +} + + + + \ No newline at end of file From 7323fda893e188968f65ef1a0b00f0e061996e90 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:15:51 -0700 Subject: [PATCH 07/53] Creating a test for default run_mod object print --- tests/testthat/test-print.sr_model.R | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/testthat/test-print.sr_model.R diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R new file mode 100644 index 00000000..3f0d0e11 --- /dev/null +++ b/tests/testthat/test-print.sr_model.R @@ -0,0 +1,9 @@ +test_that( + desc = "results are consistent with printed output for sr_model class", + code = { + withr::local_seed(1) + results <- print(nepal_sees_jags_output) |> + ssdtools:::expect_snapshot_data("default-print-runmod-object") + + } +) From 88b96aff66c11de4f1f3831e2eec69cfe67c3aba Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:16:23 -0700 Subject: [PATCH 08/53] Updating example for print default --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 0ba453b6..2b48f933 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -11,7 +11,7 @@ #' parameters by `Iso_type` and `Stratification` (if specified). #' @export #' @example -#' print.sr_model(nepal_sees_output) +#' print.sr_model(nepal_sees_jags_output) print.sr_model <- function(data) { data_group <- data |> dplyr::group_by(Stratification, Iso_type, Parameter) |> From 91a887f03e7ecfb64933b20ad9e3f4b49051fa25 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:16:46 -0700 Subject: [PATCH 09/53] Updating documentation for default print --- NAMESPACE | 1 + man/print.sr_model.Rd | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 man/print.sr_model.Rd diff --git a/NAMESPACE b/NAMESPACE index 022010b0..0bd66d02 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ S3method(autoplot,case_data) S3method(print,sero_mod_output) +S3method(print,sr_model) export(as_case_data) export(autoplot) export(get_biomarker_levels) diff --git a/man/print.sr_model.Rd b/man/print.sr_model.Rd new file mode 100644 index 00000000..6b14d968 --- /dev/null +++ b/man/print.sr_model.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/print.sr_model.R +\name{print.sr_model} +\alias{print.sr_model} +\title{Default print for run_mod object of class sr_model} +\usage{ +\method{print}{sr_model}(data) +} +\arguments{ +\item{data}{A \link{sr_model} object output from the +\code{\link[=run_mod]{run_mod()}} function.} +} +\value{ +A \link[dplyr:grouped_df]{dplyr::grouped_df} that +contains the mean posterior distribution for antibody kinetic curve +parameters by \code{Iso_type} and \code{Stratification} (if specified). +} +\description{ +A default print method for class \code{sr_model} that includes the mean posterior +distribution for antibody kinetic curve parameters by \code{Iso_type} and +\code{Stratification} (if specified). +} +\author{ +Sam Schildhauer +} From a7afd630bdaf134d4ac27c9a89570e8f586dcb59 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:20:26 -0700 Subject: [PATCH 10/53] Arranging data by Iso_type to allow for easy comparison between stratifications --- R/print.sr_model.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 2b48f933..90c47bf7 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -16,7 +16,8 @@ print.sr_model <- function(data) { data_group <- data |> dplyr::group_by(Stratification, Iso_type, Parameter) |> dplyr::summarise(mean_val = mean(value)) |> - tidyr::spread(Parameter, mean_val) + tidyr::spread(Parameter, mean_val) |> + dplyr::arrange(Iso_type) # Taking out stratification column if not specified if(unique(data$Stratification == "None")) { data_group <- data_group[,2:7] From f5be2b33313b844cea051a8c74ece9559989087e Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:21:42 -0700 Subject: [PATCH 11/53] Adding test snap for run_mod object default print --- .../_snaps/print.sr_model/default-print-runmod-object.csv | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/testthat/_snaps/print.sr_model/default-print-runmod-object.csv diff --git a/tests/testthat/_snaps/print.sr_model/default-print-runmod-object.csv b/tests/testthat/_snaps/print.sr_model/default-print-runmod-object.csv new file mode 100644 index 00000000..75d8a137 --- /dev/null +++ b/tests/testthat/_snaps/print.sr_model/default-print-runmod-object.csv @@ -0,0 +1,5 @@ +Stratification,Iso_type,alpha,shape,t1,y0,y1 +paratyphi,HlyE_IgA,0.00228672,1.66482,3.85028,2.55072,1024.3 +typhi,HlyE_IgA,0.00290543,1.61299,7.3068,2.9673,1031.9 +paratyphi,HlyE_IgG,0.00256872,1.36053,4.7794,1.72131,833.105 +typhi,HlyE_IgG,0.00153667,1.40846,8.72891,2.31451,338.572 From ba5973fa2f5f84a028787030b0c5c9ca2ccc7391 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:25:53 -0700 Subject: [PATCH 12/53] Updating default sr_model print documentation --- R/print.sr_model.R | 6 +++--- man/print.sr_model.Rd | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 90c47bf7..f4c6f40b 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -1,10 +1,10 @@ -#' @title Default print for run_mod object of class sr_model -#' @author Sam Schildhauer +#' @title Default print for [serodynamics::run_mod()] output object of class +#' `sr_model` #' @description #' A default print method for class `sr_model` that includes the mean posterior #' distribution for antibody kinetic curve parameters by `Iso_type` and #' `Stratification` (if specified). -#' @param data A [serodynamics::sr_model] object output from the +#' @param data An `sr_model` output object from the #' [serodynamics::run_mod()] function. #' @returns A [dplyr::grouped_df] that #' contains the mean posterior distribution for antibody kinetic curve diff --git a/man/print.sr_model.Rd b/man/print.sr_model.Rd index 6b14d968..847320bb 100644 --- a/man/print.sr_model.Rd +++ b/man/print.sr_model.Rd @@ -2,12 +2,13 @@ % Please edit documentation in R/print.sr_model.R \name{print.sr_model} \alias{print.sr_model} -\title{Default print for run_mod object of class sr_model} +\title{Default print for \code{\link[=run_mod]{run_mod()}} output object of class +\code{sr_model}} \usage{ \method{print}{sr_model}(data) } \arguments{ -\item{data}{A \link{sr_model} object output from the +\item{data}{An \code{sr_model} output object from the \code{\link[=run_mod]{run_mod()}} function.} } \value{ @@ -20,6 +21,3 @@ A default print method for class \code{sr_model} that includes the mean posterio distribution for antibody kinetic curve parameters by \code{Iso_type} and \code{Stratification} (if specified). } -\author{ -Sam Schildhauer -} From 4ed27e68009a4c0c21b41ef1eacd3a89a7db499e Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:28:08 -0700 Subject: [PATCH 13/53] Updating example for print.sr_model --- R/print.sr_model.R | 4 ++-- man/print.sr_model.Rd | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index f4c6f40b..887ddabf 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -10,8 +10,8 @@ #' contains the mean posterior distribution for antibody kinetic curve #' parameters by `Iso_type` and `Stratification` (if specified). #' @export -#' @example -#' print.sr_model(nepal_sees_jags_output) +#' @examples +#' print(nepal_sees_jags_output) print.sr_model <- function(data) { data_group <- data |> dplyr::group_by(Stratification, Iso_type, Parameter) |> diff --git a/man/print.sr_model.Rd b/man/print.sr_model.Rd index 847320bb..eb91c2a4 100644 --- a/man/print.sr_model.Rd +++ b/man/print.sr_model.Rd @@ -21,3 +21,6 @@ A default print method for class \code{sr_model} that includes the mean posterio distribution for antibody kinetic curve parameters by \code{Iso_type} and \code{Stratification} (if specified). } +\examples{ +print(nepal_sees_jags_output) +} From 8e5eba79442677d5f39502d2d20cee1da9cf5a35 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:28:21 -0700 Subject: [PATCH 14/53] Increment version number to 0.0.0.9035 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index bb07d694..5409ade5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: serodynamics Title: What the Package Does (One Line, Title Case) -Version: 0.0.0.9034 +Version: 0.0.0.9035 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From f377d5c9e55be420f4b59a1e0ccfca5171348e4b Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:29:03 -0700 Subject: [PATCH 15/53] Updating news --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index 1867fca0..a51dca5d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ ## New features +* Creating default print.sr_model function for sr_model class (#) * Replacing old data object with new run_mod output (#102) * Adding class assignment to run_mod output (#76) * Making prep_priors modifiable (#78) From 9711df67d111cd291ead51bfbaa02b8e49af949c Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:29:32 -0700 Subject: [PATCH 16/53] Adding print.sr_model to pkgdown --- pkgdown/_pkgdown.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 39698daf..1c1ef43b 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -41,6 +41,7 @@ reference: - title: Summarize seroresponse model estimates contents: - post_summ + - print.sr_model - title: Example data sets contents: - serodynamics_example From ff9ee850044a34b340d32e0d46322d9d1b6f6644 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:33:18 -0700 Subject: [PATCH 17/53] Deleting a previous default print method that was being created --- R/print_sero_mod_output.R | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 R/print_sero_mod_output.R diff --git a/R/print_sero_mod_output.R b/R/print_sero_mod_output.R deleted file mode 100644 index dc950058..00000000 --- a/R/print_sero_mod_output.R +++ /dev/null @@ -1,32 +0,0 @@ -#' @title Default print method for run_mod output -#' @author Sam Schildhauer -#' @description -#' Will print a default output for a run_mod object that specifies the median -#' value of the posterior distribution for serokinetic curve parameters (y0, -#' y1, t1, alpha, shape) by stratification (if specified) and antigen/iso type. -#' @param obj A [serodynamics::sero_mod_output] object. -#' @returns A [dplyr::tbl_df] that contains the median value of the posterior -#' distribution of stratifications (if any specified), antigen/iso type, and -#' parameter value. -#' @export -#' @example inst/examples/run_mod-examples.R - -print.sero_mod_output <- function(obj) { - - # Summarizing results - df_obj <- data.frame("Parameter" = obj$Parameter, "Iso_type" = obj$Iso_type, - "Stratification" = obj$Stratification, - "Value" = obj$value) - if (unique(df_obj$Stratification == "None")) { - to_print <- df_obj |> - dplyr::group_by(Iso_type, Parameter) |> - dplyr::summarize(median = median(Value)) |> - tidyr::spread(Parameter, median) - } else { - to_print <- df_obj |> - dplyr::group_by(Stratification, Iso_type, Parameter) |> - dplyr::summarize(median = median(Value)) |> - tidyr::spread(Parameter, median) - } - to_print -} From 8eed4a7c768d4813421c4390e44f18258f97d8a7 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:34:27 -0700 Subject: [PATCH 18/53] Updating function for pivot_wider --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 887ddabf..00780c98 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -16,7 +16,7 @@ print.sr_model <- function(data) { data_group <- data |> dplyr::group_by(Stratification, Iso_type, Parameter) |> dplyr::summarise(mean_val = mean(value)) |> - tidyr::spread(Parameter, mean_val) |> + pivot_wider(Parameter, mean_val) |> dplyr::arrange(Iso_type) # Taking out stratification column if not specified if(unique(data$Stratification == "None")) { From 7a5ec6266efb9f9e3491ea5476e4759522f6dd1a Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Tue, 8 Jul 2025 23:35:14 -0700 Subject: [PATCH 19/53] Updating documentation to take out old print function --- NAMESPACE | 1 - man/print.sero_mod_output.Rd | 50 ------------------------------------ 2 files changed, 51 deletions(-) delete mode 100644 man/print.sero_mod_output.Rd diff --git a/NAMESPACE b/NAMESPACE index 0bd66d02..c45e1ccf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,6 @@ # Generated by roxygen2: do not edit by hand S3method(autoplot,case_data) -S3method(print,sero_mod_output) S3method(print,sr_model) export(as_case_data) export(autoplot) diff --git a/man/print.sero_mod_output.Rd b/man/print.sero_mod_output.Rd deleted file mode 100644 index 0dd8540f..00000000 --- a/man/print.sero_mod_output.Rd +++ /dev/null @@ -1,50 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/print_sero_mod_output.R -\name{print.sero_mod_output} -\alias{print.sero_mod_output} -\title{Default print method for run_mod output} -\usage{ -\method{print}{sero_mod_output}(obj) -} -\arguments{ -\item{obj}{A \link{sero_mod_output} object.} -} -\value{ -A \link[dplyr:tbl_df]{dplyr::tbl_df} that contains the median value of the posterior -distribution of stratifications (if any specified), antigen/iso type, and -parameter value. -} -\description{ -Will print a default output for a run_mod object that specifies the median -value of the posterior distribution for serokinetic curve parameters (y0, -y1, t1, alpha, shape) by stratification (if specified) and antigen/iso type. -} -\examples{ -if (!is.element(runjags::findjags(), c("", NULL))) { - library(runjags) - set.seed(1) - library(dplyr) - strat1 <- serocalculator::typhoid_curves_nostrat_100 |> - sim_case_data(n = 100) |> - mutate(strat = "stratum 2") - strat2 <- serocalculator::typhoid_curves_nostrat_100 |> - sim_case_data(n = 100) |> - mutate(strat = "stratum 1") - - dataset <- bind_rows(strat1, strat2) - - fitted_model <- run_mod( - data = dataset, # The data set input - file_mod = serodynamics_example("model.jags"), - nchain = 4, # Number of mcmc chains to run - nadapt = 100, # Number of adaptations to run - nburn = 100, # Number of unrecorded samples before sampling begins - nmc = 1000, - niter = 2000, # Number of iterations - strat = "strat" - ) # Variable to be stratified -} -} -\author{ -Sam Schildhauer -} From eb4e282c2f32fd4a93b8b8cb4d7b9f0e9a213fb9 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 9 Jul 2025 17:34:54 -0700 Subject: [PATCH 20/53] Updating wordlist --- inst/WORDLIST | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inst/WORDLIST b/inst/WORDLIST index 12b8fafc..ba6d083d 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,6 +1,8 @@ +Biomarker CMD CodeFactor Codecov +Hyperpriors JAGs Lifecycle Postprocess @@ -9,6 +11,8 @@ Traceplots behaviour biomarker biomarkers +bmatrix +cdot dobson dotplots geoms @@ -16,21 +20,27 @@ ggproto hyp hyperprior hyperpriors +ij iso isotype isotypes +mathcal mcmc nmc +overfit params prec +pred rhat sd seroconversion serocourse seroresponse seroresponses +sr strat stratifications tbl +tibble unstratified wishdf From 141ba3c7aebfc6fa4b9a9fc5d1dd1b7b61db507d Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 9 Jul 2025 17:46:37 -0700 Subject: [PATCH 21/53] Updating lint --- R/print.sr_model.R | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 00780c98..a5dff189 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -14,17 +14,14 @@ #' print(nepal_sees_jags_output) print.sr_model <- function(data) { data_group <- data |> - dplyr::group_by(Stratification, Iso_type, Parameter) |> - dplyr::summarise(mean_val = mean(value)) |> - pivot_wider(Parameter, mean_val) |> - dplyr::arrange(Iso_type) + dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> + dplyr::summarise(mean_val = mean(.data$value)) |> + tidyr::pivot_wider(names_from = .data$Parameter, + values_from = .data$mean_val) |> + dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified - if(unique(data$Stratification == "None")) { - data_group <- data_group[,2:7] + if (unique(data$Stratification == "None")) { + data_group <- data_group[, 2:7] } data_group } - - - - \ No newline at end of file From f95a88aa4b0323d8a901e055ff01b55862321926 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 9 Jul 2025 20:29:47 -0700 Subject: [PATCH 22/53] Fixing no lint. --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index a5dff189..33a3fed2 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -12,7 +12,7 @@ #' @export #' @examples #' print(nepal_sees_jags_output) -print.sr_model <- function(data) { +print.sr_model <- function(data) { # nolint data_group <- data |> dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> dplyr::summarise(mean_val = mean(.data$value)) |> From 4dcd890514bcf6fec80a3a040595c778a6f6d30a Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Sun, 13 Jul 2025 19:32:41 -0700 Subject: [PATCH 23/53] Updating test lint --- tests/testthat/test-print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index 3f0d0e11..1a523b39 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -3,7 +3,7 @@ test_that( code = { withr::local_seed(1) results <- print(nepal_sees_jags_output) |> - ssdtools:::expect_snapshot_data("default-print-runmod-object") + ssdtools:::expect_snapshot_data("default-print-runmod-object") } ) From ee0a73c934f0266f10feea147e79761aaac9a71c Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Sun, 13 Jul 2025 19:36:59 -0700 Subject: [PATCH 24/53] Changing review recommended test code --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 33a3fed2..86aee141 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -17,7 +17,7 @@ print.sr_model <- function(data) { # nolint dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> dplyr::summarise(mean_val = mean(.data$value)) |> tidyr::pivot_wider(names_from = .data$Parameter, - values_from = .data$mean_val) |> + values_from = mean_val) |> dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified if (unique(data$Stratification == "None")) { From 0dbc9a2e811a37566f1050b08cf9e29fba32dfcd Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Sun, 13 Jul 2025 19:38:03 -0700 Subject: [PATCH 25/53] Updating test code based on review recommendations --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 86aee141..675acad5 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -16,7 +16,7 @@ print.sr_model <- function(data) { # nolint data_group <- data |> dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> dplyr::summarise(mean_val = mean(.data$value)) |> - tidyr::pivot_wider(names_from = .data$Parameter, + tidyr::pivot_wider(names_from = Parameter, values_from = mean_val) |> dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified From a22ed27c47ec4093deaf5b157bb0997d1ea95844 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Sun, 13 Jul 2025 20:13:05 -0700 Subject: [PATCH 26/53] Adding .data$ back in to code --- R/print.sr_model.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 675acad5..33a3fed2 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -16,8 +16,8 @@ print.sr_model <- function(data) { # nolint data_group <- data |> dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> dplyr::summarise(mean_val = mean(.data$value)) |> - tidyr::pivot_wider(names_from = Parameter, - values_from = mean_val) |> + tidyr::pivot_wider(names_from = .data$Parameter, + values_from = .data$mean_val) |> dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified if (unique(data$Stratification == "None")) { From 29ec557dcc461c794fd95eefc5f47047b7f19ebe Mon Sep 17 00:00:00 2001 From: Samuel Schildhauer <165851188+sschildhauer@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:18:44 -0700 Subject: [PATCH 27/53] Update NEWS.md Co-authored-by: Douglas Ezra Morrison --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a51dca5d..3d2dedea 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ ## New features -* Creating default print.sr_model function for sr_model class (#) +* Creating default print.sr_model function for sr_model class (#114) * Replacing old data object with new run_mod output (#102) * Adding class assignment to run_mod output (#76) * Making prep_priors modifiable (#78) From 9de64b06cfe30434bac93abe35ec3001e8688418 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 16 Jul 2025 20:29:10 -0700 Subject: [PATCH 28/53] Updating parameter inputs to refelct x, ... --- R/print.sr_model.R | 7 ++++--- man/print.sr_model.Rd | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 33a3fed2..d71fcbe3 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -4,7 +4,8 @@ #' A default print method for class `sr_model` that includes the mean posterior #' distribution for antibody kinetic curve parameters by `Iso_type` and #' `Stratification` (if specified). -#' @param data An `sr_model` output object from the +#' @param x An `sr_model` output object from [run_mod()]. +#' @param ... Additional arguments affecting the summary produced. #' [serodynamics::run_mod()] function. #' @returns A [dplyr::grouped_df] that #' contains the mean posterior distribution for antibody kinetic curve @@ -12,8 +13,8 @@ #' @export #' @examples #' print(nepal_sees_jags_output) -print.sr_model <- function(data) { # nolint - data_group <- data |> +print.sr_model <- function(x, ...) { # nolint + data_group <- x |> dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> dplyr::summarise(mean_val = mean(.data$value)) |> tidyr::pivot_wider(names_from = .data$Parameter, diff --git a/man/print.sr_model.Rd b/man/print.sr_model.Rd index eb91c2a4..7f4d0fee 100644 --- a/man/print.sr_model.Rd +++ b/man/print.sr_model.Rd @@ -5,10 +5,12 @@ \title{Default print for \code{\link[=run_mod]{run_mod()}} output object of class \code{sr_model}} \usage{ -\method{print}{sr_model}(data) +\method{print}{sr_model}(x, ...) } \arguments{ -\item{data}{An \code{sr_model} output object from the +\item{x}{An \code{sr_model} output object from \code{\link[=run_mod]{run_mod()}}.} + +\item{...}{Additional arguments affecting the summary produced. \code{\link[=run_mod]{run_mod()}} function.} } \value{ From b1d15c48a72dbfe2760052edbec12f976b9d9341 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 16 Jul 2025 20:32:13 -0700 Subject: [PATCH 29/53] Fixing column call for taking out Stratification --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index d71fcbe3..da8abbbf 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -22,7 +22,7 @@ print.sr_model <- function(x, ...) { # nolint dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified if (unique(data$Stratification == "None")) { - data_group <- data_group[, 2:7] + data_group <- data_group |> select(-c(Stratification)) } data_group } From 0dcac1899160dd16f9bfcca60c3271d77d596fb2 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 16 Jul 2025 20:33:09 -0700 Subject: [PATCH 30/53] Fixing column Stratification exclusion --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index da8abbbf..5c4b4c6f 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -22,7 +22,7 @@ print.sr_model <- function(x, ...) { # nolint dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified if (unique(data$Stratification == "None")) { - data_group <- data_group |> select(-c(Stratification)) + data_group <- data_group |> select(-all_of(Stratification)) } data_group } From 86e9965108ecc6ca870d3c86b459b3028ed3d191 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 16 Jul 2025 20:36:01 -0700 Subject: [PATCH 31/53] Changing object call in function to "x" --- R/print.sr_model.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 5c4b4c6f..46bf5d26 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -14,7 +14,7 @@ #' @examples #' print(nepal_sees_jags_output) print.sr_model <- function(x, ...) { # nolint - data_group <- x |> + x <- x |> dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> dplyr::summarise(mean_val = mean(.data$value)) |> tidyr::pivot_wider(names_from = .data$Parameter, @@ -22,7 +22,7 @@ print.sr_model <- function(x, ...) { # nolint dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified if (unique(data$Stratification == "None")) { - data_group <- data_group |> select(-all_of(Stratification)) + x <- x |> select(-all_of(Stratification)) } - data_group + invisible(x) } From d97e4b2e750d3913cc7593464704b05fdae3dc9f Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 16 Jul 2025 20:46:07 -0700 Subject: [PATCH 32/53] Updating test for default print --- tests/testthat/test-print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index 1a523b39..440b820b 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -3,7 +3,7 @@ test_that( code = { withr::local_seed(1) results <- print(nepal_sees_jags_output) |> - ssdtools:::expect_snapshot_data("default-print-runmod-object") + ssdtools:::expect_snapshot("default-print-runmod-object") } ) From 42b181013acd8ce2c63ff31bbeb8f8d709453c0c Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 16 Jul 2025 20:59:15 -0700 Subject: [PATCH 33/53] Increment version number to 0.0.0.9036 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index eac0b2cf..a5726c00 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: serodynamics Title: What the Package Does (One Line, Title Case) -Version: 0.0.0.9035 +Version: 0.0.0.9036 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From 5c9fe1c125f97c996fb400b1b254476c2a9229f8 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Wed, 16 Jul 2025 21:10:23 -0700 Subject: [PATCH 34/53] Updating visible binding --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 46bf5d26..356501c6 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -22,7 +22,7 @@ print.sr_model <- function(x, ...) { # nolint dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified if (unique(data$Stratification == "None")) { - x <- x |> select(-all_of(Stratification)) + x <- x |> select(-all_of(.data$Stratification)) } invisible(x) } From 1252e18ec751ff8b89d7e3e8058a45589be44a25 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Thu, 31 Jul 2025 16:12:25 +0700 Subject: [PATCH 35/53] Merged origin/main into default_print --- NEWS.md | 1 + R/ab.R | 11 +++++------ tests/testthat/_snaps/ab.md | 6 +++--- tests/testthat/test-ab.R | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5b444e15..b854db07 100644 --- a/NEWS.md +++ b/NEWS.md @@ -47,6 +47,7 @@ None yet ## Developer-facing changes +* vectorized `ab()` function (#116) * Added `lintr::undesirable_function_linter()` to `.lintr.R` (#81) * Reformatted `.lintr` as R file (following https://github.com/r-lib/lintr/issues/2844#issuecomment-2776725389) (#81) diff --git a/R/ab.R b/R/ab.R index 10d2d585..652995c1 100644 --- a/R/ab.R +++ b/R/ab.R @@ -1,10 +1,9 @@ ab <- function(t, y0, y1, t1, alpha, shape) { beta <- bt(y0, y1, t1) - yt <- 0 - if (t <= t1) { - yt <- y0 * exp(beta * t) - } else { - yt <- (y1^(1 - shape) - (1 - shape) * alpha * (t - t1))^(1 / (1 - shape)) - } + yt <- ifelse( + t <= t1, + y0 * exp(beta * t), + (y1^(1 - shape) - (1 - shape) * alpha * (t - t1))^(1 / (1 - shape)) + ) return(yt) } diff --git a/tests/testthat/_snaps/ab.md b/tests/testthat/_snaps/ab.md index 70d5f3c2..cdacb76b 100644 --- a/tests/testthat/_snaps/ab.md +++ b/tests/testthat/_snaps/ab.md @@ -1,8 +1,8 @@ # results are consistent Code - do.call(dplyr::mutate(dplyr::select(params, -c(antigen_iso, iter), shape = r), - t = 10), what = ab) + do.call(dplyr::mutate(dplyr::rename(dplyr::select(params, -c(antigen_iso, iter)), + shape = r), t = 10), what = ab) Output - [1] 63.09329 + [1] 63.09329 157.74561 diff --git a/tests/testthat/test-ab.R b/tests/testthat/test-ab.R index f9407dae..51f388f2 100644 --- a/tests/testthat/test-ab.R +++ b/tests/testthat/test-ab.R @@ -1,11 +1,11 @@ test_that("results are consistent", { params <- serocalculator::typhoid_curves_nostrat_100 |> - head(1) + head(2) params |> - dplyr::select(-c(antigen_iso, iter), - shape = r) |> + dplyr::select(-c(antigen_iso, iter)) |> + dplyr::rename(shape = r) |> dplyr::mutate(t = 10) |> do.call(what = ab) |> expect_snapshot() From 9a6931eb04c65cfbc3bc8f7539c53a340207b832 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Thu, 31 Jul 2025 22:00:15 +0700 Subject: [PATCH 36/53] Updating output description and documentation --- R/print.sr_model.R | 7 ++++++- man/print.sr_model.Rd | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 356501c6..861e43c6 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -7,13 +7,17 @@ #' @param x An `sr_model` output object from [run_mod()]. #' @param ... Additional arguments affecting the summary produced. #' [serodynamics::run_mod()] function. -#' @returns A [dplyr::grouped_df] that +#' @returns A data summary that #' contains the mean posterior distribution for antibody kinetic curve #' parameters by `Iso_type` and `Stratification` (if specified). #' @export #' @examples #' print(nepal_sees_jags_output) print.sr_model <- function(x, ...) { # nolint + + cat("An sr_model with the following mean values:") + cat("\n") + cat("\n") x <- x |> dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> dplyr::summarise(mean_val = mean(.data$value)) |> @@ -24,5 +28,6 @@ print.sr_model <- function(x, ...) { # nolint if (unique(data$Stratification == "None")) { x <- x |> select(-all_of(.data$Stratification)) } + print(data.frame(x)) invisible(x) } diff --git a/man/print.sr_model.Rd b/man/print.sr_model.Rd index 7f4d0fee..49fc5db4 100644 --- a/man/print.sr_model.Rd +++ b/man/print.sr_model.Rd @@ -14,7 +14,7 @@ \code{\link[=run_mod]{run_mod()}} function.} } \value{ -A \link[dplyr:grouped_df]{dplyr::grouped_df} that +A data summary that contains the mean posterior distribution for antibody kinetic curve parameters by \code{Iso_type} and \code{Stratification} (if specified). } From 6dda0ca8f74cd2e7238d3caf73381047a821c2ee Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Thu, 31 Jul 2025 22:12:30 +0700 Subject: [PATCH 37/53] Increment version number to 0.0.0.9037 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index a5726c00..44d2af08 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: serodynamics Title: What the Package Does (One Line, Title Case) -Version: 0.0.0.9036 +Version: 0.0.0.9037 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From 26c78000fd23d35b884f078c4625a8e7393701c6 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Thu, 31 Jul 2025 22:27:30 +0700 Subject: [PATCH 38/53] Updating test and snapshot --- tests/testthat/_snaps/print.sr_model.md | 27 +++++++++++++++++++++++++ tests/testthat/test-print.sr_model.R | 5 +---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 tests/testthat/_snaps/print.sr_model.md diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md new file mode 100644 index 00000000..a235ba65 --- /dev/null +++ b/tests/testthat/_snaps/print.sr_model.md @@ -0,0 +1,27 @@ +# results are consistent with printed output for sr_model class + + Code + print(nepal_sees_jags_output) + Output + An sr_model with the following mean values: + + Condition + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Parameter"` instead of `.data$Parameter` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"mean_val"` instead of `.data$mean_val` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Parameter"` instead of `.data$Parameter` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"mean_val"` instead of `.data$mean_val` + Output + Stratification Iso_type alpha shape t1 y0 y1 + 1 paratyphi HlyE_IgA 0.002286716 1.664825 3.850284 2.550720 1024.2988 + 2 typhi HlyE_IgA 0.002905432 1.612991 7.306797 2.967301 1031.8956 + 3 paratyphi HlyE_IgG 0.002568724 1.360532 4.779399 1.721313 833.1053 + 4 typhi HlyE_IgG 0.001536668 1.408457 8.728905 2.314505 338.5723 + diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index 440b820b..50966cd5 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -1,9 +1,6 @@ test_that( desc = "results are consistent with printed output for sr_model class", code = { - withr::local_seed(1) - results <- print(nepal_sees_jags_output) |> - ssdtools:::expect_snapshot("default-print-runmod-object") - + expect_snapshot(print(nepal_sees_jags_output)) } ) From 27b1c52b3872b226a07d63461a9f0f68b3bf7283 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 1 Aug 2025 11:47:49 +0700 Subject: [PATCH 39/53] Fixing lint in test --- tests/testthat/test-print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index 50966cd5..d0b248c6 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -1,6 +1,6 @@ test_that( desc = "results are consistent with printed output for sr_model class", code = { - expect_snapshot(print(nepal_sees_jags_output)) + expect_snapshot(print(nepal_sees_jags_output)) } ) From e6b54c1c57dcc402d6bdd16f4df8e78c56506f15 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 1 Aug 2025 11:49:09 +0700 Subject: [PATCH 40/53] Fixing for closure --- R/print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 861e43c6..3d18e6b0 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -25,7 +25,7 @@ print.sr_model <- function(x, ...) { # nolint values_from = .data$mean_val) |> dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified - if (unique(data$Stratification == "None")) { + if (unique(.data$Stratification == "None")) { x <- x |> select(-all_of(.data$Stratification)) } print(data.frame(x)) From 1657ff1ad6c00ecae7e5fbcec0ccb82901fbf046 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 1 Aug 2025 11:59:46 +0700 Subject: [PATCH 41/53] Fixing data call in if statement --- R/print.sr_model.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 3d18e6b0..90edf098 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -25,8 +25,8 @@ print.sr_model <- function(x, ...) { # nolint values_from = .data$mean_val) |> dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified - if (unique(.data$Stratification == "None")) { - x <- x |> select(-all_of(.data$Stratification)) + if (unique(x$Stratification == "None")) { + x <- x |> select(-c(.data$Stratification)) } print(data.frame(x)) invisible(x) From 571bf165e8f31de981d793903280b96b026fe265 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 1 Aug 2025 13:38:56 +0700 Subject: [PATCH 42/53] Updating snap. --- R/print.sr_model.R | 7 ++++--- tests/testthat/_snaps/print.sr_model.md | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 90edf098..2fe15be5 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -19,8 +19,9 @@ print.sr_model <- function(x, ...) { # nolint cat("\n") cat("\n") x <- x |> - dplyr::group_by(.data$Stratification, .data$Iso_type, .data$Parameter) |> - dplyr::summarise(mean_val = mean(.data$value)) |> + dplyr::summarise(.by = c(.data$Stratification, .data$Iso_type, + .data$Parameter), + mean_val = mean(.data$value)) |> tidyr::pivot_wider(names_from = .data$Parameter, values_from = .data$mean_val) |> dplyr::arrange(.data$Iso_type) @@ -28,6 +29,6 @@ print.sr_model <- function(x, ...) { # nolint if (unique(x$Stratification == "None")) { x <- x |> select(-c(.data$Stratification)) } - print(data.frame(x)) + print(x) invisible(x) } diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md index a235ba65..7da7bdd4 100644 --- a/tests/testthat/_snaps/print.sr_model.md +++ b/tests/testthat/_snaps/print.sr_model.md @@ -6,6 +6,15 @@ An sr_model with the following mean values: Condition + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Stratification"` instead of `.data$Stratification` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Iso_type"` instead of `.data$Iso_type` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Parameter"` instead of `.data$Parameter` Warning: Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. i Please use `"Parameter"` instead of `.data$Parameter` @@ -19,9 +28,11 @@ Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. i Please use `"mean_val"` instead of `.data$mean_val` Output - Stratification Iso_type alpha shape t1 y0 y1 - 1 paratyphi HlyE_IgA 0.002286716 1.664825 3.850284 2.550720 1024.2988 - 2 typhi HlyE_IgA 0.002905432 1.612991 7.306797 2.967301 1031.8956 - 3 paratyphi HlyE_IgG 0.002568724 1.360532 4.779399 1.721313 833.1053 - 4 typhi HlyE_IgG 0.001536668 1.408457 8.728905 2.314505 338.5723 + # A tibble: 4 x 7 + Stratification Iso_type alpha shape t1 y0 y1 + + 1 typhi HlyE_IgA 0.00291 1.61 7.31 2.97 1032. + 2 paratyphi HlyE_IgA 0.00229 1.66 3.85 2.55 1024. + 3 typhi HlyE_IgG 0.00154 1.41 8.73 2.31 339. + 4 paratyphi HlyE_IgG 0.00257 1.36 4.78 1.72 833. From 95a91c9843bf911288e8595a145c97681c9c022e Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Sun, 3 Aug 2025 22:30:27 +0700 Subject: [PATCH 43/53] making output table a dataframe to get rid of tibble descriptors --- R/print.sr_model.R | 2 +- tests/testthat/_snaps/print.sr_model.md | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 2fe15be5..cb9e8cd9 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -29,6 +29,6 @@ print.sr_model <- function(x, ...) { # nolint if (unique(x$Stratification == "None")) { x <- x |> select(-c(.data$Stratification)) } - print(x) + print(as.data.frame(x)) invisible(x) } diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md index 7da7bdd4..db291607 100644 --- a/tests/testthat/_snaps/print.sr_model.md +++ b/tests/testthat/_snaps/print.sr_model.md @@ -28,11 +28,9 @@ Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. i Please use `"mean_val"` instead of `.data$mean_val` Output - # A tibble: 4 x 7 - Stratification Iso_type alpha shape t1 y0 y1 - - 1 typhi HlyE_IgA 0.00291 1.61 7.31 2.97 1032. - 2 paratyphi HlyE_IgA 0.00229 1.66 3.85 2.55 1024. - 3 typhi HlyE_IgG 0.00154 1.41 8.73 2.31 339. - 4 paratyphi HlyE_IgG 0.00257 1.36 4.78 1.72 833. + Stratification Iso_type alpha shape t1 y0 y1 + 1 typhi HlyE_IgA 0.002905432 1.612991 7.306797 2.967301 1031.8956 + 2 paratyphi HlyE_IgA 0.002286716 1.664825 3.850284 2.550720 1024.2988 + 3 typhi HlyE_IgG 0.001536668 1.408457 8.728905 2.314505 338.5723 + 4 paratyphi HlyE_IgG 0.002568724 1.360532 4.779399 1.721313 833.1053 From 3915ec2a24fcf199c080847692776fdf3656ce5d Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Mon, 4 Aug 2025 15:50:31 +0700 Subject: [PATCH 44/53] Updating print test --- tests/testthat/_snaps/print.sr_model.md | 2 +- tests/testthat/test-print.sr_model.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md index db291607..bbc55ae3 100644 --- a/tests/testthat/_snaps/print.sr_model.md +++ b/tests/testthat/_snaps/print.sr_model.md @@ -1,7 +1,7 @@ # results are consistent with printed output for sr_model class Code - print(nepal_sees_jags_output) + nepal_sees_jags_output Output An sr_model with the following mean values: diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index d0b248c6..a3f99df4 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -1,6 +1,6 @@ test_that( desc = "results are consistent with printed output for sr_model class", code = { - expect_snapshot(print(nepal_sees_jags_output)) + expect_snapshot(nepal_sees_jags_output) } ) From 4233b52596183e23806d4724598d56729119cece Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Mon, 4 Aug 2025 16:14:42 +0700 Subject: [PATCH 45/53] Updating snap --- tests/testthat/_snaps/print.sr_model.md | 2 +- tests/testthat/test-print.sr_model.R | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md index bbc55ae3..13a362ad 100644 --- a/tests/testthat/_snaps/print.sr_model.md +++ b/tests/testthat/_snaps/print.sr_model.md @@ -1,7 +1,7 @@ # results are consistent with printed output for sr_model class Code - nepal_sees_jags_output + suppressWarnings(nepal_sees_jags_output) Output An sr_model with the following mean values: diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index a3f99df4..820bd268 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -1,6 +1,8 @@ test_that( desc = "results are consistent with printed output for sr_model class", code = { - expect_snapshot(nepal_sees_jags_output) + nepal_sees_jags_output |> + suppressWarnings() |> + expect_snapshot() } ) From 37f451e33ccc6fe940814aa6d56e5e5e9c0d7fe4 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Thu, 7 Aug 2025 13:10:20 +0700 Subject: [PATCH 46/53] Making model output median value --- R/print.sr_model.R | 10 +++++----- man/print.sr_model.Rd | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index cb9e8cd9..980904be 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -1,9 +1,9 @@ #' @title Default print for [serodynamics::run_mod()] output object of class #' `sr_model` #' @description -#' A default print method for class `sr_model` that includes the mean posterior -#' distribution for antibody kinetic curve parameters by `Iso_type` and -#' `Stratification` (if specified). +#' A default print method for class `sr_model` that includes the median +#' posterior distribution for antibody kinetic curve parameters by `Iso_type` +#' and `Stratification` (if specified). #' @param x An `sr_model` output object from [run_mod()]. #' @param ... Additional arguments affecting the summary produced. #' [serodynamics::run_mod()] function. @@ -15,13 +15,13 @@ #' print(nepal_sees_jags_output) print.sr_model <- function(x, ...) { # nolint - cat("An sr_model with the following mean values:") + cat("An sr_model with the following median values:") cat("\n") cat("\n") x <- x |> dplyr::summarise(.by = c(.data$Stratification, .data$Iso_type, .data$Parameter), - mean_val = mean(.data$value)) |> + median_val = stats::median(.data$value)) |> tidyr::pivot_wider(names_from = .data$Parameter, values_from = .data$mean_val) |> dplyr::arrange(.data$Iso_type) diff --git a/man/print.sr_model.Rd b/man/print.sr_model.Rd index 49fc5db4..67be9223 100644 --- a/man/print.sr_model.Rd +++ b/man/print.sr_model.Rd @@ -19,9 +19,9 @@ contains the mean posterior distribution for antibody kinetic curve parameters by \code{Iso_type} and \code{Stratification} (if specified). } \description{ -A default print method for class \code{sr_model} that includes the mean posterior -distribution for antibody kinetic curve parameters by \code{Iso_type} and -\code{Stratification} (if specified). +A default print method for class \code{sr_model} that includes the median +posterior distribution for antibody kinetic curve parameters by \code{Iso_type} +and \code{Stratification} (if specified). } \examples{ print(nepal_sees_jags_output) From 3f8c7066ef5f106ed3811a65a86eb7d6bcaa0f3d Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Thu, 7 Aug 2025 13:11:32 +0700 Subject: [PATCH 47/53] Updating test snap --- R/print.sr_model.R | 2 +- tests/testthat/_snaps/print.sr_model.md | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/R/print.sr_model.R b/R/print.sr_model.R index 980904be..c7eca62c 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -23,7 +23,7 @@ print.sr_model <- function(x, ...) { # nolint .data$Parameter), median_val = stats::median(.data$value)) |> tidyr::pivot_wider(names_from = .data$Parameter, - values_from = .data$mean_val) |> + values_from = .data$median_val) |> dplyr::arrange(.data$Iso_type) # Taking out stratification column if not specified if (unique(x$Stratification == "None")) { diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md index 13a362ad..01b63ff3 100644 --- a/tests/testthat/_snaps/print.sr_model.md +++ b/tests/testthat/_snaps/print.sr_model.md @@ -3,7 +3,7 @@ Code suppressWarnings(nepal_sees_jags_output) Output - An sr_model with the following mean values: + An sr_model with the following median values: Condition Warning: @@ -20,17 +20,17 @@ i Please use `"Parameter"` instead of `.data$Parameter` Warning: Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"mean_val"` instead of `.data$mean_val` + i Please use `"median_val"` instead of `.data$median_val` Warning: Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. i Please use `"Parameter"` instead of `.data$Parameter` Warning: Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"mean_val"` instead of `.data$mean_val` + i Please use `"median_val"` instead of `.data$median_val` Output - Stratification Iso_type alpha shape t1 y0 y1 - 1 typhi HlyE_IgA 0.002905432 1.612991 7.306797 2.967301 1031.8956 - 2 paratyphi HlyE_IgA 0.002286716 1.664825 3.850284 2.550720 1024.2988 - 3 typhi HlyE_IgG 0.001536668 1.408457 8.728905 2.314505 338.5723 - 4 paratyphi HlyE_IgG 0.002568724 1.360532 4.779399 1.721313 833.1053 + Stratification Iso_type alpha shape t1 y0 y1 + 1 typhi HlyE_IgA 0.001788800 1.538820 6.235540 2.405515 342.565 + 2 paratyphi HlyE_IgA 0.001272495 1.614535 3.700500 2.406050 153.787 + 3 typhi HlyE_IgG 0.001140990 1.346445 7.025800 2.073250 252.156 + 4 paratyphi HlyE_IgG 0.001742340 1.321350 4.370495 1.537045 288.325 From ff21aa331d984005c6e6ee786f3da8c94e370993 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 8 Aug 2025 14:26:49 +0700 Subject: [PATCH 48/53] Increment version number to 0.0.0.9038 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 44d2af08..65983bda 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: serodynamics Title: What the Package Does (One Line, Title Case) -Version: 0.0.0.9037 +Version: 0.0.0.9038 Authors@R: c( person("Peter", "Teunis", , "p.teunis@emory.edu", role = c("aut", "cph"), comment = "Author of the method and original code."), From 47ab5b07d3193e95fd77f58f148035f9edf8c204 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 8 Aug 2025 14:33:51 +0700 Subject: [PATCH 49/53] Redoing snap --- tests/testthat/_snaps/print.sr_model.md | 36 ------------------------- 1 file changed, 36 deletions(-) delete mode 100644 tests/testthat/_snaps/print.sr_model.md diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md deleted file mode 100644 index 01b63ff3..00000000 --- a/tests/testthat/_snaps/print.sr_model.md +++ /dev/null @@ -1,36 +0,0 @@ -# results are consistent with printed output for sr_model class - - Code - suppressWarnings(nepal_sees_jags_output) - Output - An sr_model with the following median values: - - Condition - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Stratification"` instead of `.data$Stratification` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Iso_type"` instead of `.data$Iso_type` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Parameter"` instead of `.data$Parameter` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Parameter"` instead of `.data$Parameter` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"median_val"` instead of `.data$median_val` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Parameter"` instead of `.data$Parameter` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"median_val"` instead of `.data$median_val` - Output - Stratification Iso_type alpha shape t1 y0 y1 - 1 typhi HlyE_IgA 0.001788800 1.538820 6.235540 2.405515 342.565 - 2 paratyphi HlyE_IgA 0.001272495 1.614535 3.700500 2.406050 153.787 - 3 typhi HlyE_IgG 0.001140990 1.346445 7.025800 2.073250 252.156 - 4 paratyphi HlyE_IgG 0.001742340 1.321350 4.370495 1.537045 288.325 - From 0c2a6bd403bd0a9f4145d51824dc5ab4cd0715b3 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 8 Aug 2025 14:35:15 +0700 Subject: [PATCH 50/53] Updating snap to suppress warnings --- R/print.sr_model.R | 3 ++- tests/testthat/_snaps/print.sr_model.md | 36 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 tests/testthat/_snaps/print.sr_model.md diff --git a/R/print.sr_model.R b/R/print.sr_model.R index c7eca62c..a10f930b 100644 --- a/R/print.sr_model.R +++ b/R/print.sr_model.R @@ -24,7 +24,8 @@ print.sr_model <- function(x, ...) { # nolint median_val = stats::median(.data$value)) |> tidyr::pivot_wider(names_from = .data$Parameter, values_from = .data$median_val) |> - dplyr::arrange(.data$Iso_type) + dplyr::arrange(.data$Iso_type) |> + suppressWarnings() # Taking out stratification column if not specified if (unique(x$Stratification == "None")) { x <- x |> select(-c(.data$Stratification)) diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md new file mode 100644 index 00000000..01b63ff3 --- /dev/null +++ b/tests/testthat/_snaps/print.sr_model.md @@ -0,0 +1,36 @@ +# results are consistent with printed output for sr_model class + + Code + suppressWarnings(nepal_sees_jags_output) + Output + An sr_model with the following median values: + + Condition + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Stratification"` instead of `.data$Stratification` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Iso_type"` instead of `.data$Iso_type` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Parameter"` instead of `.data$Parameter` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Parameter"` instead of `.data$Parameter` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"median_val"` instead of `.data$median_val` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"Parameter"` instead of `.data$Parameter` + Warning: + Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. + i Please use `"median_val"` instead of `.data$median_val` + Output + Stratification Iso_type alpha shape t1 y0 y1 + 1 typhi HlyE_IgA 0.001788800 1.538820 6.235540 2.405515 342.565 + 2 paratyphi HlyE_IgA 0.001272495 1.614535 3.700500 2.406050 153.787 + 3 typhi HlyE_IgG 0.001140990 1.346445 7.025800 2.073250 252.156 + 4 paratyphi HlyE_IgG 0.001742340 1.321350 4.370495 1.537045 288.325 + From 04c720002ca5cb39520e0ce06f51cdfa654d75bf Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 8 Aug 2025 14:35:27 +0700 Subject: [PATCH 51/53] Updating snap --- tests/testthat/_snaps/print.sr_model.md | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md index 01b63ff3..e796e1c9 100644 --- a/tests/testthat/_snaps/print.sr_model.md +++ b/tests/testthat/_snaps/print.sr_model.md @@ -5,29 +5,6 @@ Output An sr_model with the following median values: - Condition - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Stratification"` instead of `.data$Stratification` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Iso_type"` instead of `.data$Iso_type` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Parameter"` instead of `.data$Parameter` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Parameter"` instead of `.data$Parameter` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"median_val"` instead of `.data$median_val` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"Parameter"` instead of `.data$Parameter` - Warning: - Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0. - i Please use `"median_val"` instead of `.data$median_val` - Output Stratification Iso_type alpha shape t1 y0 y1 1 typhi HlyE_IgA 0.001788800 1.538820 6.235540 2.405515 342.565 2 paratyphi HlyE_IgA 0.001272495 1.614535 3.700500 2.406050 153.787 From 87dd5c7351870aa0b4bcf0f406ed819078bdfdb2 Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 8 Aug 2025 14:49:45 +0700 Subject: [PATCH 52/53] troubleshooting snap --- tests/testthat/_snaps/print.sr_model.md | 2 +- tests/testthat/test-print.sr_model.R | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/testthat/_snaps/print.sr_model.md b/tests/testthat/_snaps/print.sr_model.md index e796e1c9..634ff26c 100644 --- a/tests/testthat/_snaps/print.sr_model.md +++ b/tests/testthat/_snaps/print.sr_model.md @@ -1,7 +1,7 @@ # results are consistent with printed output for sr_model class Code - suppressWarnings(nepal_sees_jags_output) + nepal_sees_jags_output Output An sr_model with the following median values: diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index 820bd268..b835db0e 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -1,8 +1,6 @@ test_that( desc = "results are consistent with printed output for sr_model class", code = { - nepal_sees_jags_output |> - suppressWarnings() |> - expect_snapshot() + testthat::expect_snapshot(nepal_sees_jags_output) } ) From 9f2fd61a1b038df496865eff79455458bd91e41d Mon Sep 17 00:00:00 2001 From: sschildhauer Date: Fri, 8 Aug 2025 15:14:49 +0700 Subject: [PATCH 53/53] Fixing lint --- tests/testthat/test-print.sr_model.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-print.sr_model.R b/tests/testthat/test-print.sr_model.R index b835db0e..c1715a0d 100644 --- a/tests/testthat/test-print.sr_model.R +++ b/tests/testthat/test-print.sr_model.R @@ -1,6 +1,6 @@ test_that( desc = "results are consistent with printed output for sr_model class", code = { - testthat::expect_snapshot(nepal_sees_jags_output) + testthat::expect_snapshot(nepal_sees_jags_output) } )