diff options
author | Naeem Model <me@nmode.ca> | 2024-11-16 11:18:14 +0000 |
---|---|---|
committer | Naeem Model <me@nmode.ca> | 2024-11-16 11:18:14 +0000 |
commit | 5515b4053552128ff8b6cb3237ebbfc9c7743f4c (patch) | |
tree | c13bf45731c0a5802166db22f1b4ec2804ef19c9 /inst/app/scripts/estimators.R | |
parent | a96d14d8f393fc1a6a659c9bf0ffadbcc55fadfc (diff) |
Change SI units to "day(s)" and "week(s)" in the estimates table
Diffstat (limited to 'inst/app/scripts/estimators.R')
-rw-r--r-- | inst/app/scripts/estimators.R | 8 |
1 files changed, 5 insertions, 3 deletions
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. |