format_dollars: Make numeric currency values human readable

format_dollarsR Documentation

Make numeric currency values human readable

Description

Make numeric currency values human readable

Usage

format_dollars(amount, digits)

Arguments

amount

Price or vector of prices (character, numeric, or integer)

digits

The number of decimal places. Set equal to 2 to include cents (defaults to 0 i.e. whole dollars)

Value

A character vector

Examples


# format_dollars("2423562534234")
# "$2,423,562,534,234"

# format_dollars("2423562534234.876", 0)
# "$2,423,562,534,234"

# format_dollars("2423562534234.876", 2)
# "$2,423,562,534,234.88"

# format_dollars("2423562534234", 2)
# "$2,423,562,534,234.00"

priceR documentation built on Oct. 22, 2023, 1:10 a.m.