Learn R Programming

formattable (version 0.2.1)

comma: Numeric vector with thousands separators

Description

Numeric vector with thousands separators

Usage

comma(x, digits, format = "f", big.mark = ",", ...)

# S3 method for default comma(x, digits = 2L, format = "f", big.mark = ",", ...)

# S3 method for character comma(x, digits = max(get_digits(x)), format = "f", big.mark = ",", ...)

Arguments

x

a numeric vector.

digits

an integer to indicate the number of digits of the percentage string.

format

format type passed to formatC.

big.mark

thousands separator

...

additional parameters passed to formattable.

Examples

Run this code
# NOT RUN {
comma(1000000)
comma(c(1250000, 225000))
comma(c(1250000, 225000), format = "d")
comma("123,345.123")
# }

Run the code above in your browser using DataLab