double.threshold: which threshold was hit last (or how many of them).

Description Usage Arguments Examples

View source: R/utils.R

Description

returns a logical status vector. at each position the status is TRUE if data exceeds the 'threshold.true', FALSE if falls below the 'threshold.false'. if the data lays between the thresholds, the last status is taken forward. 'threshold.true' must be higher than 'threshold.false'.

the 'multi.' variants will count how many 'thresholds' were exceeded. they expect the threshold.false and threshold.true as columns in the thresholds data.frame.

Usage

1
2
double.threshold(data, threshold.false, threshold.true, initial.status, on.equality)
multi.double.threshold(data, thresholds, initial.status)

Arguments

data

the input data vector. data frames are examined columnwise.

threshold.false

the lower threshold (off).

threshold.true

the upper threshold (on).

thresholds

a data.frame with two columns (threshold.false, threshold.true) and as many rows as the thresholds you want to count.

initial.status

initial status, used if initial value is between a false/true threshold pair. it is of the same type as the return type of the function, i.e.: a logical for 'double.threshold' and an integer for 'multi.double.threshold'.

on.equality

a boolean, indicates whether a threshold is to be considered reached also on equality or only on exceeding it. defaults to FALSE (equality is not enough).

Examples

1
2
3
# am I baking my merengues right?
temp <- c(50, 90, 110, 120, 117, 114, 124, 120, 118)
double.threshold(temp, 116, 119)

delftfews documentation built on May 2, 2019, 4:48 p.m.