checkRange: Check the range of a numeric object

checkRangeR Documentation

Check the range of a numeric object

Description

Tests the input range based on the specified interval.

Usage

checkRange(x, range.=0:1, inclusion=c(TRUE,TRUE))

Arguments

x

an object belonging to class numeric.

inclusion

a two-element logical vector defining the boundary tests. For example, if range.=0:1, the interval boundaries are tested as follows

inclusion=c(TRUE,TRUE)

range(x) must be on [0,1].

inclusion=c(TRUE,FALSE)

range(x) must be on [0,1).

inclusion=c(FALSE,TRUE)

range(x) must be on (0,1].

inclusion=c(FALSE,FALSE)

range(x) must be on (0,1).

If only a single logical element is specified, it is replicated to form a two-element vector. If more than two elements are specified, only the first two are used as described above. Default: c(TRUE,TRUE).

range.

a two-element numeric vector containing the limits of the test interval. Default: 0:1.

Value

no output is returned. If these tests fail, a stop condition is executed.

See Also

isVectorAtomic, checkVectorType, checkScalarType.

Examples

## expect no output from the following calls 
checkRange(pi,range=c(0,5))
checkRange(1:5,range=c(1,5), inclusion=c(TRUE,TRUE))

ifultools documentation built on July 14, 2022, 5:07 p.m.