The returned function will format a vector of values as currency. If accuracy is not specified, values are rounded to the nearest cent, and cents are displayed if any of the values has a non-zero cents and the largest value is less than largest_with_cents which by default is 100,000.

dollar_format(accuracy = NULL, scale = 1, prefix = "$", suffix = "", big.mark = ",", decimal.mark = ".", trim = TRUE, largest_with_cents = 1e+05, negative_parens = FALSE, ...) dollar(x, accuracy = NULL, scale = 1, prefix = "$", suffix = "",
big.mark = ",", decimal.mark = ".", trim = TRUE,
largest_with_cents = 1e+05, negative_parens = FALSE, ...)

accuracy Number to round to, NULL for automatic guess. A scaling factor: x will be multiply by scale before formating (useful to display the data on another scale, e.g. in k$). Symbols to display before and after value. Character used between every 3 digits to separate thousands. The character to be used to indicate the numeric decimal point. Logical, if FALSE, values are right-justified to a common width (see base::format()). The value that all values of x must be less than in order for the cents to be displayed. Should negative values be shown with parentheses? Other arguments passed on to base::format(). A numeric vector to format. ## Value A function with single parameter x, a numeric vector, that returns a character vector. ## Examples dollar_format()(c(-100, 0.23, 1.456565, 2e3))#>  "$-100.00"  "$0.23" "$1.46"     "$2,000.00"dollar_format()(c(1:10 * 10))#>  "$10"  "$20" "$30"  "$40" "$50"  "$60" "$70"  "$80" "$90"  "$100"dollar(c(100, 0.23, 1.456565, 2e3))#>  "$100.00"   "$0.23" "$1.46"     "$2,000.00"dollar(c(1:10 * 10))#>  "$10"  "$20" "$30"  "$40" "$50"  "$60" "$70"  "$80" "$90"  "$100"dollar(10^(1:8))#>  "$10"          "$100" "$1,000"       "$10,000" "$100,000"
#>  "$1,000,000" "$10,000,000"  "$100,000,000" usd <- dollar_format(prefix = "USD ") usd(c(100, -100))#>  "USD 100" "USD -100" euro <- dollar_format(prefix = "", suffix = "\u20ac") euro(100)#>  "100€" finance <- dollar_format(negative_parens = TRUE) finance(c(-100, 100))#>  "($100)" "\$100"