rnd: Round and format

View source: R/rnd.R

rndR Documentation

Round and format

Description

Round to a given number of significant digits to show variability in a vector of numbers.

Usage

rnd(x, digits, ...)

## Default S3 method:
rnd(x, ...)

Arguments

x

an object to be rounded and formatted

digits

significant digits for variation in x

...

passed on to format function

Details

Instead of rounding to a given number of significant digits, or rounding to a given significance, 'rnd' rounds so that the variability in a set of number is exhibited to a given number of digits. For example, 100.1233, 100.2345, 100.3456, rounded to 3 significant digits would be 100., 100., 100., but rounded to 3 significant digits for variability is 100.123, 100.234, 100.345.

Methods (by class)

  • rnd(default): default method

See Also

pfmt, rpfmt

Examples

rnd(c(0.00001111111,0.000022222,0.000015), scientific = F)
rnd(c(0.00001111111,0.000022222,0.000015)+100, scientific = F)
round(c(0.00001111111,0.000022222,0.000015))
round(c(0.00001111111,0.000022222,0.000015)+100)
rnd(123)
rnd(123.45678901)

gmonette/spida2 documentation built on July 14, 2024, 12:45 p.m.