Last chance! 50% off unlimited learning
Sale ends in
This function lets the user format numerical values nicely
formatNum(
x,
decimals = 2,
type = getOption("lares.formatNum"),
scientific = FALSE,
pre = "",
pos = "",
abbr = FALSE
)
Numerical Vector
Integer. Amount of decimals to display
Integer. 1 for International standards. 2 for American Standards. Use options("lares.formatNum" = 2) to set this parameter globally.
Boolean. Scientific notation?
Character. Add string before or after number
Boolean. Abbreviate using num_abbr()? You can use the `decimals` parameter to set abbr's `n`(-1) parameter.
Other Data Wrangling:
balance_data()
,
categ_reducer()
,
cleanText()
,
date_cuts()
,
date_feats()
,
dateformat()
,
formatTime()
,
holidays()
,
impute()
,
left()
,
normalize()
,
numericalonly()
,
ohe_commas()
,
ohse()
,
rbind_full()
,
removenacols()
,
removenarows()
,
replaceall()
,
right()
,
textFeats()
,
textTokenizer()
,
vector2text()
,
year_month()
,
year_week()
# NOT RUN {
formatNum(1.23456, decimals = 3)
formatNum(1.23456, type = 1)
formatNum(1.23456, pre = "$", pos = "/p")
formatNum(123456, abbr = TRUE)
formatNum(1234567890, abbr = TRUE)
formatNum(1234567890, decimals = 0, abbr = TRUE)
# }
Run the code above in your browser using DataLab