Format an errors
object for pretty printing.
Arguments
- x
an
errors
object.- digits
how many significant digits are to be used for uncertainties. The default,
NULL
, usesgetOption("errors.digits", 1)
. Usedigits="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.
Examples
x <- set_errors(1:3*100, 1:3*100 * 0.05)
format(x)
#> [1] "100(5)" "200(10)" "300(20)"
format(x, digits=2)
#> [1] "100.0(50)" "200(10)" "300(15)"
format(x, scientific=TRUE)
#> [1] "1.00(5)e2" "2.0(1)e2" "3.0(2)e2"
format(x, notation="plus-minus")
#> [1] "100 ± 5" "200 ± 10" "300 ± 20"
x <- set_errors(c(0.827, 0.827), c(0.119, 0.367))
format(x, notation="plus-minus", digits="pdg")
#> [1] "0.83 ± 0.12" "0.8 ± 0.4"