f_dollar
- A wrapper for f_num
that formats
dollar values as labeled dollars.
f_dollar(x, leading_zero = TRUE, digits = 2, ...)ff_dollar(...)
A vector of values.
logical. If TRUE
a leading zero will be added to
values from 0 up to 1.
The number of digits to use. Defaults to 2. Can be set
globally via: options(numformdigits = n)
where n is the number of
digits beyond the decimal point to include.
Other values passed to f_num
.
Returns a string of publication ready digits.
# NOT RUN {
f_dollar(c(30, 33.45, .1))
# }
# NOT RUN {
library(dplyr)
f_dollar(c(0.0, 0, .2, -00.02, 1122222, pi)) %>% f_comma()
# }
Run the code above in your browser using DataLab