Learn R Programming

pmxTools (version 1.3)

fmt_signif: Format a number with the correct number of significant digits and trailing zeroes.

Description

Format a number with the correct number of significant digits and trailing zeroes.

Usage

fmt_signif(x, digits = 3)

Value

A string containing the properly-formatted number.

Arguments

x

A vector of numeric values.

digits

The number of significant digits values should have (defaults to 3).

Author

Justin Wilkins, justin.wilkins@occams.com

Examples

Run this code
if (FALSE) {
 fmt_signif(c(36.44, 0.0002, 3336.7), digits=3)
}

Run the code above in your browser using DataLab