Convenience wrapper on useful unit_format function offered within scales package. Useful when producing scales without 0: "" "1K" "10K" instead of "0k" "1K" "10K".

units_without_zero(x, ...)

Arguments

x

A numeric vector

...

other arguments passed to unit_format

Value

A character vector.

Examples

vec_tst <- c(0, 1000, 1e6) units_without_zero(vec_tst, unit = "K", scale = 1e-3, sep = "")
#> [1] "" "1K" "1 000K"
# "0" "1K" "1,000K" # For comparison scales::unit_format(unit = "K", scale = 1e-3, sep = "")(vec_tst)
#> [1] "0.0K" "1.0K" "1 000.0K"
# [1] "0K" "1K" "1,000K"