diff --git a/R/print.R b/R/print.R index 4561590..ee30fe6 100644 --- a/R/print.R +++ b/R/print.R @@ -4,6 +4,7 @@ #' #' @param x an \code{errors} object. #' @param digits how many significant digits are to be used for uncertainties. +#' The default, \code{NULL}, uses \code{getOption("errors.digits", 1)}. #' Use \code{digits="pdg"} to choose an appropriate number of digits for each #' value according to the Particle Data Group rounding rule (see references). #' @param scientific logical specifying whether the elements should be @@ -32,7 +33,7 @@ #' #' @export format.errors = function(x, - digits = getOption("errors.digits", 1), + digits = NULL, scientific = FALSE, notation = getOption("errors.notation", "parenthesis"), decimals = getOption("errors.decimals", FALSE), @@ -40,6 +41,7 @@ format.errors = function(x, { stopifnot(notation %in% c("parenthesis", "plus-minus")) + if (is.null(digits)) digits <- getOption("errors.digits", 1) digits <- if (digits == "pdg") digits_pdg(.e(x)) else rep(digits, length(x)) scipen <- getOption("scipen", 0) diff --git a/man/format.errors.Rd b/man/format.errors.Rd index 0e17b1e..9502eca 100644 --- a/man/format.errors.Rd +++ b/man/format.errors.Rd @@ -4,14 +4,15 @@ \alias{format.errors} \title{Encode \code{errors}} \usage{ -\method{format}{errors}(x, digits = getOption("errors.digits", 1), - scientific = FALSE, notation = getOption("errors.notation", - "parenthesis"), decimals = getOption("errors.decimals", FALSE), ...) +\method{format}{errors}(x, digits = NULL, scientific = FALSE, + notation = getOption("errors.notation", "parenthesis"), + decimals = getOption("errors.decimals", FALSE), ...) } \arguments{ \item{x}{an \code{errors} object.} \item{digits}{how many significant digits are to be used for uncertainties. +The default, \code{NULL}, uses \code{getOption("errors.digits", 1)}. Use \code{digits="pdg"} to choose an appropriate number of digits for each value according to the Particle Data Group rounding rule (see references).}