oom: Get order of magnitude for numbers

Description Usage Arguments Details Value See Also Examples

Description

This is meant to get the order of magnitude from measurement errors to round these errors and measured values or centers like mean or median in an empirical way.

Usage

1
oom(x)

Arguments

x

A numeric vector of measurement uncertainties, e.g., sd, se

Details

The following convention is implemented:

Value

A numeric vector containing orders of magnitude, can be passed to base::round() as digits.

See Also

Other rounding functions: mpformat, round_up

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Round very long error to 1 significant digit
x <- 0.074385229
oom_x <- oom(x)
round(x, oom_x)

# This starts with 1 and gets 2 signif. digits
x <- 0.174385229
oom_x <- oom(x)
round(x, oom_x)

# This again, but rounds up to 1 signif. digit
x <- 0.197385229
oom_x <- oom(x)
round(x, oom_x)

tamaracha/mpformatr documentation built on May 8, 2019, 3:14 a.m.