pretty_signif: Round a value to a defined number of significant digits...

View source: R/rounding.R

pretty_signifR Documentation

Round a value to a defined number of significant digits printing out trailing zeros, if applicable

Description

Round a value to a defined number of significant digits printing out trailing zeros, if applicable

Usage

pretty_signif(x, digits = 6, sci_range = 6, sci_sep = "e")

Arguments

x

The number to round.

digits

integer indicating the number of significant digits.

sci_range

integer (or Inf) indicating when to switch to scientific notation instead of floating point. Zero indicates always use scientific; Inf indicates to never use scientific notation; otherwise, scientific notation is used when abs(log10(x)) > sci_range.

sci_sep

The separator to use for scientific notation strings (typically this will be either "e" or "x10^" for computer- or human-readable output).

Details

Values that are not standard numbers like Inf, NA, and NaN are returned as "Inf", "NA", and NaN.

Value

A string with the value.

See Also

signif(), pretty_round().


r-lib/prettyunits documentation built on March 9, 2024, 5:03 p.m.