Feature description
In gtsummary::label_style_sigfig(3) for any number < 0.1 — it assumes 3 decimal places
is enough, this is not correct. 0.037 needs 4 decimal places for 3 sig figs
(0.0370), and 0.0037 would need 5.
The function to keep 3 sig figures should be
fmt_3sig <- function(x) { if (is.na(x) || !is.finite(x)) return(NA_character_) gsub("\\.$", "", formatC(signif(x, 3), digits = 3, format = "fg", flag = "#")) }
Code of Conduct
Contribution Guidelines
Security Policy
Feature description
In gtsummary::label_style_sigfig(3) for any number < 0.1 — it assumes 3 decimal places
is enough, this is not correct. 0.037 needs 4 decimal places for 3 sig figs
(0.0370), and 0.0037 would need 5.
The function to keep 3 sig figures should be
fmt_3sig <- function(x) { if (is.na(x) || !is.finite(x)) return(NA_character_) gsub("\\.$", "", formatC(signif(x, 3), digits = 3, format = "fg", flag = "#")) }Code of Conduct
Contribution Guidelines
Security Policy