Based heavily on the scales work by Hadley

thousands_format()

thousands(x)

Arguments

x

a numeric vector to format

Value

a function with single paramater x, a numeric vector, that returns a character vector

See also

Examples

thousands_format()(c(1, 1e3, 2000, 1e6))
#> [1] "0k" "1k" "2k" "1,000k"
thousands_format()(c(1, 1e3, 2000, 1e6))
#> [1] "0k" "1k" "2k" "1,000k"
thousands(c(1, 1e3, 2000, 1e6))
#> [1] "0k" "1k" "2k" "1,000k"