From f798499e9a9090ee7279ee58db6eea0abbbe4133 Mon Sep 17 00:00:00 2001 From: James Azam Date: Mon, 30 Oct 2023 22:07:49 +0000 Subject: [PATCH] Don't allow null values --- R/estimate_infections.R | 12 ++++++------ R/estimate_secondary.R | 8 ++++---- R/estimate_truncation.R | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/estimate_infections.R b/R/estimate_infections.R index cc99b8cc8..0a4a13e2b 100644 --- a/R/estimate_infections.R +++ b/R/estimate_infections.R @@ -135,14 +135,14 @@ estimate_infections <- function(reported_cases, verbose = interactive()) { # Validate inputs check_reports_valid(reported_cases, model = "estimate_infections") - assert_class(generation_time, "generation_time_opts", null.ok = TRUE) - assert_class(delays, "delay_opts", null.ok = TRUE) - assert_class(truncation, "trunc_opts", null.ok = TRUE) + assert_class(generation_time, "generation_time_opts") + assert_class(delays, "delay_opts") + assert_class(truncation, "trunc_opts") assert_class(rt, "rt_opts", null.ok = TRUE) - assert_class(backcalc, "backcalc_opts", null.ok = TRUE) + assert_class(backcalc, "backcalc_opts") assert_class(gp, "gp_opts", null.ok = TRUE) - assert_class(obs, "obs_opts", null.ok = TRUE) - assert_class(stan, "stan_opts", null.ok = TRUE) + assert_class(obs, "obs_opts") + assert_class(stan, "stan_opts") assert_numeric(horizon, lower = 0) assert_numeric(CrIs, lower = 0, upper = 1) assert_logical(filter_leading_zeros) diff --git a/R/estimate_secondary.R b/R/estimate_secondary.R index 19e97409b..dc4a6f0c3 100644 --- a/R/estimate_secondary.R +++ b/R/estimate_secondary.R @@ -152,10 +152,10 @@ estimate_secondary <- function(reports, ...) { # Validate the inputs check_reports_valid(reports, model = "estimate_secondary") - assert_class(secondary, "secondary_opts", null.ok = TRUE) - assert_class(delays, "delay_opts", null.ok = TRUE) - assert_class(truncation, "trunc_opts", null.ok = TRUE) - assert_class(obs, "obs_opts", null.ok = TRUE) + assert_class(secondary, "secondary_opts") + assert_class(delays, "delay_opts") + assert_class(truncation, "trunc_opts") + assert_class(obs, "obs_opts") assert_numeric(burn_in, lower = 0) assert_numeric(CrIs, lower = 0, upper = 1) assert_data_frame(priors, null.ok = TRUE) diff --git a/R/estimate_truncation.R b/R/estimate_truncation.R index b780087e6..dba907c93 100644 --- a/R/estimate_truncation.R +++ b/R/estimate_truncation.R @@ -152,8 +152,8 @@ estimate_truncation <- function(obs, max_truncation, trunc_max = 10, ...) { # Validate inputs walk(obs, check_reports_valid, model = "estimate_truncation") - assert_class(truncation, "dist_spec", null.ok = TRUE) - assert_class(model, "stanfit", null.ok = TRUE) + assert_class(truncation, "dist_spec") + assert_class(model, "stanfit") assert_numeric(CrIs, lower = 0, upper = 1) assert_logical(weigh_delay_priors) assert_logical(verbose)