Learn R Programming

ssdtools (version 0.3.7)

comma_signif: Comma and Significance Formatter

Description

By default the numeric vectors are first rounded to three significant figures. Then scales::commas is only applied to values greater than or equal to 1000 to ensure that labels are permitted to have different numbers of decimal places.

Usage

comma_signif(x, digits = 3, ...)

Arguments

x

A numeric vector to format.

digits

A whole number specifying the number of significant figures

...

Additional arguments passed to scales::comma.

Value

A character vector.

Examples

Run this code
# NOT RUN {
comma_signif(c(0.1, 1, 10, 1000))
scales::comma(c(0.1, 1, 10, 1000))
# }

Run the code above in your browser using DataLab