Learn R Programming

errors (version 0.4.2)

format.errors: Encode errors

Description

Format an errors object for pretty printing.

Usage

# S3 method for errors
format(x, digits = NULL, scientific = FALSE,
  notation = getOption("errors.notation", "parenthesis"), ...)

Arguments

x

an errors object.

digits

how many significant digits are to be used for uncertainties. The default, NULL, uses getOption("errors.digits", 1). Use digits="pdg" to choose an appropriate number of digits for each value according to the Particle Data Group rounding rule (see references).

scientific

logical specifying whether the elements should be encoded in scientific format.

notation

error notation; "parenthesis" and "plus-minus" are supported through the "errors.notation" option.

...

ignored.

References

K. Nakamura et al. (Particle Data Group), J. Phys. G 37, 075021 (2010)

Examples

Run this code
x <- set_errors(1:3*100, 1:3*100 * 0.05)
format(x)
format(x, digits=2)
format(x, scientific=TRUE)
format(x, notation="plus-minus")

x <- set_errors(c(0.827, 0.827), c(0.119, 0.367))
format(x, notation="plus-minus", digits="pdg")

Run the code above in your browser using DataLab