format_number_hdx {gghdx} | R Documentation |
Format numbers in HDX style
Description
Does the formatting found in label_number_hdx
.
Usage
format_number_hdx(x, additional_prefix)
Arguments
x |
Numeric vector to format |
additional_prefix |
Additional prefix to add to string, that will come
between |
Details
Just for continuity, values are labeled with T for trillion, and that is the maximum formatting available, anything above the trillions will continue to be truncated to report in the trillions.
Deals with negative values in case those ever need to be formatted in similar
manners. Also ensures that rounding is performed so numbers look correct.
Not to be used for percents, which should just use scales::label_percent()
.
Designed like the scales::
family of label functions, the return value of
label_number_hdx
is a function, based on the additional_prefix
. So you
should pass it in to scales_...()
labels
parameter in the same way as
scales_...()
Value
Character vector of formatted strings