From 5515b4053552128ff8b6cb3237ebbfc9c7743f4c Mon Sep 17 00:00:00 2001 From: Naeem Model Date: Sat, 16 Nov 2024 11:18:14 +0000 Subject: Change SI units to "day(s)" and "week(s)" in the estimates table --- inst/app/scripts/estimators.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'inst/app/scripts/estimators.R') diff --git a/inst/app/scripts/estimators.R b/inst/app/scripts/estimators.R index a86b1d4..7c457ea 100644 --- a/inst/app/scripts/estimators.R +++ b/inst/app/scripts/estimators.R @@ -225,8 +225,9 @@ eval_estimator <- function(estimator, dataset) { max_shape = estimator$max_shape, max_scale = estimator$max_scale ) estimated_mu <- round(sum(estimate$supp * estimate$pmf), 2) - estimate <- paste0(round(estimate$r0, 2), " (SI = ", estimated_mu, - " ", tolower(dataset[, 2]), ")" + mu_units <- if (dataset[, 2] == "Days") "day(s)" else "week(s)" + estimate <- paste0( + round(estimate$r0, 2), " (SI = ", estimated_mu, " ", mu_units, ")" ) } else { mu <- convert_mu_units(dataset[, 2], estimator$mu_units, estimator$mu) @@ -273,7 +274,8 @@ estimator_mu_text <- function(estimator) { if (is.na(estimator$mu)) { return("—") } - paste(estimator$mu, tolower(estimator$mu_units)) + mu_units <- if (estimator$mu_units == "Days") "day(s)" else "week(s)" + paste(estimator$mu, mu_units) } # Render the estimates table whenever it is updated. -- cgit v1.2.3