groupGeneric.errors {errors}R Documentation

S3 Group Generic Functions

Description

Math, Ops and Summary group generic methods for errors objects with support for automatic uncertainty propagation (see groupGeneric for a comprehensive list of available methods).

Usage

## S3 method for class 'errors'
Math(x, ...)

## S3 method for class 'errors'
Ops(e1, e2)

## S3 method for class 'errors'
Summary(..., na.rm = FALSE)

Arguments

x, e1, e2

objects.

...

further arguments passed to methods.

na.rm

logical: should missing values be removed?

Details

Math

The sign method returns a numeric value without uncertainty. floor, ceiling, trunc, round and signif add the rounding error to the original uncertainty. lgamma, gamma, digamma and trigamma are not implemented. The rest of the methods propagate the uncertainty as expected from the first-order Taylor series method.

Ops

Boolean operators drop the uncertainty (showing a warning once) and operate on the numeric values. The rest of the operators propagate the uncertainty as expected from the first-order Taylor series method. Any numeric operand is automatically coerced to errors (showing a warning once) with no uncertainty.

Summary

The methods all and any are not supported for errors objects and fail with an informative message. min, max (and range) return the minimum or (and) maximum value minus/plus its uncertainty. sum and prod propagate the uncertainty as expected from the first-order Taylor series method.

Examples

x <- set_errors(1:3, 0.1)
exp(x)
log(x)
cumsum(x)
cumprod(x)

y <- set_errors(4:6, 0.2)
x / sqrt(y) + y * sin(x)

# numeric values are automatically coerced to errors
x^2

# boolean operators drop uncertainty
y > x

c(min(x), max(x))
range(x)
sum(y)
prod(y)


[Package errors version 0.4.1 Index]