sig: Format digits

View source: R/utils.R

sigR Documentation

Format digits

Description

Use sig() to set the number of significant digits; use digit1() to limit to one digit. See examples.

Usage

sig(x, digits = 3, maxex = getOption("pmtables.maxex", NULL), ...)

digit1(x, ...)

rnd(x, digits = 0, ...)

Arguments

x

numeric; value to manipulate.

digits

numeric; number of significant digits.

maxex

numeric; maximum number of significant digits before moving to scientific notation.

...

other arguments that are not used.

Details

When x is an integer, x is returned after coercing to character, without further processing.

Value

A character vector of formatted values.

Examples

sig(1.123455)
sig(0.123455)
sig(1.123455, digits = 5)
sig(1123, maxex = 3)
sig(1123, maxex = 4)

sig(1L)

digit1(1.234)
digit1(1321.123)


metrumresearchgroup/pmtables documentation built on Dec. 22, 2024, 1:34 a.m.