Skip to contents

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).

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"