From b974fcfb3e343de83728c05b1177a80d083c30da Mon Sep 17 00:00:00 2001 From: Ian Taylor Date: Fri, 10 Mar 2023 15:46:54 -0800 Subject: [PATCH] feat: print signif digits in param table #78 #81 --- R/table_pars.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/table_pars.R b/R/table_pars.R index e14a543..0df1966 100644 --- a/R/table_pars.R +++ b/R/table_pars.R @@ -91,15 +91,15 @@ table_pars <- function(output, dplyr::slice(rows) %>% dplyr::select(Label, Value, Phase, Min, Max, Pr_type, Prior, Parm_StDev, Pr_SD, Status) %>% dplyr::mutate( - Value = sprintf("%8.3f", Value), - Bounds = sprintf("(%8.3f, %8.3f)", Min, Max) %>% stringr::str_replace("\\(\\s+", "("), + Value = signif_string(Value, 3), + Bounds = paste0("(", signif_string(Min, 2), ", ", signif_string(Max, 2), ")"), Status = dplyr::case_when( is.na(Status) ~ "fixed", Status == "act" ~ "dev", Status == "OK" ~ "ok", TRUE ~ Status ), - SD = ifelse(is.na(Parm_StDev), "0", sprintf("%2.2f", Parm_StDev)), + SD = ifelse(is.na(Parm_StDev), "0", signif_string(Parm_StDev, 3)), pv = sprintf("%2.3f", Prior), psd = sprintf("%2.3f", Pr_SD), Prior = dplyr::case_when(