Perform a spike test. This is a variant of rtqc_spike() which checks the absolute difference between the current measurement and the previous/next measurements.

rtqc_spike_alt(x, spike.threshold)

Arguments

x

A vector of values.

spike.threshold

A length-2 list specifying "suspect" and "fail" thresholds. Each threshold can be either a single value (static threshold) or a vector of same length as x (dynamic threshold). Thresholds are typically specific to location and/or climate and based on expert judgment.

Value

An ordered factor of test flags of same length as x.

Examples

fake.data = c(1, 1.1, 1, 1.2, 1, 1.3, 1, 1.4, 1, 1.5, 1) rtqc_spike(fake.data, c(0.15, 0.25))
#> [1] <NA> pass pass suspect suspect fail fail fail fail #> [10] fail <NA> #> Levels: pass < not evaluated < suspect < fail