Format to 1 Decimal Place

fmt_pct(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_pct(45.678)
#> [1] "45.7"
fmt_pct(NA)
#> [1] "NE"