numform (version 0.5.0)

f_dollar: Format Dollars

Description

f_dollar - A wrapper for f_num that formats dollar values as labeled dollars.

Usage

f_dollar(x, leading_zero = TRUE, digits = 2, ...)

ff_dollar(...)

Arguments

x

A vector of values.

leading_zero

logical. If TRUE a leading zero will be added to values from 0 up to 1.

digits

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.

Value

Returns a string of publication ready digits.

See Also

f_num

Examples

Run this code
# 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 DataCamp Workspace