Format numeric values with significant digits and minimal trailing zeros
Source:R/helper_functions.R
label_signif_clean.RdThis function formats numeric values to a specified number of significant digits, avoiding scientific notation and unnecessary trailing zeros. Useful for plotting labels where readability is important across varying numeric magnitudes.
Examples
label_signif_clean(c(0.0001234, 0.0456, 1.23, 12.3, 123.4))
#> [1] "0.00012" "0.046" "1.2" "12" "120"