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] "1.72M" "461K" "-1.27M" "-687K" "-446K" "1.22M" "360K" "401K"
#> [9] "111K" "-556K"
num_abbr(rnorm(10) * 1e6, n = 1)
#> [1] "2M" "500K" "-2M" "700K" "-500K" "-1M" "-200K" "-1M" "-700K"
#> [10] "-600K"
num_abbr(c("3K", "-58.3M", NA, 1), numeric = TRUE)
#> [1] 3000 -58300000 NA 1