Description Usage Arguments Details Value Examples
This picks out the order of magnitude of each number in a vector and returns a formatted abbreviation, such as 1230 –> 1.2k. It handles abbreviations through the trillions; after that, it's suggested that you switch over to scientific notation. The convenience of this function over those from the scales
package is that you can mix & match orders of magnitude.
1 2 3 | big_number(x, digits = 2)
big_money(x, digits = 2, currency = "$")
|
x |
A numeric vector |
digits |
Number of digits (significant figures) to keep; defaults to 2 |
currency |
Symbol to use to denote currency; defaults |
Its sibling big_money
tacks on a currency symbol, placed after a negative sign if applicable.
A character vector
1 2 3 4 5 6 | big_number(c(123, 12345, 1234567), digits = 3)
big_number(c(-12000, 15000, 16000, 77777))
big_money(c(-12000, 15000, 16000, 2e6))
# take care with your significant digits choices
purrr::map_chr(1:3, ~big_number(987, digits = .))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.