[Stable]

Formats a numeric value to 3 significant figures, removing trailing decimals.

fmt_3sig(x)

Arguments

x

(numeric(1))
a single numeric value.

Value

A character string, "NE" if x is NA, or NA_character_ if x is non-finite.

Examples

fmt_3sig(0.001234)
#> [1] "0.00123"
fmt_3sig(123456)
#> [1] "123000"