sf: Specify significant figures for printing

View source: R/formatting-utils.R

sfR Documentation

Specify significant figures for printing

Description

This function specifies the number of significant figures to print (when\ passed to the accuracy argument of nmbr() and related functions).

Usage

sf(x, n, dp_min = -Inf, dp_max = Inf)

Arguments

x

Vector of values for which significant figures are calculated

n

Number of significant figures to print

dp_min

(optional) Minimum number of decimal places to print. Use negative values for positive powers of 10; e.g., dp_min = -2 will print all values to at least the 100's digit, even if that results in more than n significant figures.

dp_max

(optional) Maximum number of decimal places to print. Use negative values for positive powers of 10; e.g., dp_max = -2 will print all values to at most the 100's digit, even if that results in fewer than n significant figures.

Value

A vector of the same length as x, suitable to be passed to the accuracy argument of nmbr() and related functions.

See Also

dp, number-formatting


uo-cmor/formattr documentation built on Sept. 13, 2023, 10:46 p.m.