Skip to contents

Numbers as the key figures of the cards show them: in full under 1,000, such as 7 and 999, and from there with one decimal and K, M or B, such as 1.3K, 12.9K and 4.2M, without the decimal from 100 on, such as 456K. A number that would round to 1000K is 1M. NA is a dash.

Usage

fmt_compact(x)

Arguments

x

Numbers.

Value

A character vector.

Examples

rghcard:::fmt_compact(c(7, 999, 1284, 12900, 456000, 999960, 4.2e6, NA))
#> [1] "7"     "999"   "1.3K"  "12.9K" "456K"  "1M"    "4.2M"  "–"