Skip to contents

Build an error-series value object for create_observed_data()'s error argument. Carries the error y-values, an optional unit, and an auxiliary type.

The unit is not validated here: the error dimension is the values-series dimension, which this helper does not see. create_observed_data() validates the error unit against the values dimension when a unit is present, and defaults the error unit to the values unit when unit is NULL.

Usage

error(value, unit = NULL, type = "ArithmeticStdDev")

Arguments

value

Numeric vector. Error y-values, same length as the values series.

unit

Character. Optional unit for the error. Defaults (in the factory) to the values-series unit when NULL.

type

Character. Auxiliary type for the error, one of the schema AuxiliaryType values: "ArithmeticStdDev" (the default), "GeometricStdDev", "ArithmeticMeanPop", or "GeometricMeanPop".

Value

An error_spec object to pass to create_observed_data().

Examples

error(c(0, 1.2, 1.5, 1.1, 0.6))
#> $value
#> [1] 0.0 1.2 1.5 1.1 0.6
#> 
#> $unit
#> NULL
#> 
#> $type
#> [1] "ArithmeticStdDev"
#> 
#> attr(,"class")
#> [1] "error_spec"     "osp_value_spec"