This function converts a numeric vector's values into their abbreviated character equivalent, i.e. 100E6 into 100M and viceversa.
See also
Other Data Wrangling:
balance_data()
,
categ_reducer()
,
cleanText()
,
date_cuts()
,
date_feats()
,
file_name()
,
formatHTML()
,
holidays()
,
impute()
,
left()
,
normalize()
,
ohe_commas()
,
ohse()
,
quants()
,
removenacols()
,
replaceall()
,
replacefactor()
,
textFeats()
,
textTokenizer()
,
vector2text()
,
year_month()
,
zerovar()
Examples
num_abbr(rnorm(10) * 1e6)
#> [1] "-560K" "-230K" "1.56M" "70.5K" "129K" "1.72M" "461K" "-1.27M"
#> [9] "-687K" "-446K"
num_abbr(rnorm(10) * 1e6, n = 1)
#> [1] "1M" "400K" "400K" "100K" "-600K" "2M" "500K" "-2M" "700K"
#> [10] "-500K"
num_abbr(c("3K", "-58.3M", NA, 1), numeric = TRUE)
#> [1] 3000 -58300000 NA 1