Learn R Programming

scales (version 0.2.0)

dollar_format: Currency formatter: round to nearest cent and display dollar sign.

Description

Currency formatter: round to nearest cent and display dollar sign.

Usage

dollar_format()

dollar(x)

Arguments

x
a numeric vector to format

Value

  • a function with single paramater x, a numeric vector, that returns a character vector

Examples

Run this code
dollar_format()(c(100, 0.23, 1.456565, 2e3))
dollar_format()(c(1:10 * 10))
dollar(c(100, 0.23, 1.456565, 2e3))
dollar(c(1:10 * 10))

Run the code above in your browser using DataLab