in_interval: Determine Whether Numeric Value Lies Within Specified...

Description Usage Arguments Value Author(s)

Description

This is a simple function to check whether a value is contained within the interval [lo, hi]. The function also allows specifying whether the interval is closed on the left, i.e. (lo, hi]), on the right only, i.e. [lo, hi), or both (lo, hi).

Usage

1
in_interval(x, lo, hi, closed.right=TRUE, closed.left=TRUE)

Arguments

x

A numeric value.

lo

A numeric value specifying the lower bound of the interval.

hi

A numeric value specifying the upper bound of the interval.

closed.right

Boolean; is the interval closed on the right (upper) side? Defaults to TRUE.

closed.left

Boolean; is the interval closed on the left (lower) side? Defaults to TRUE.

Value

TRUE if the value x lies within the interval, FALSE if it does not.

Author(s)

Ryan Kyle, ryan.kyle@mail.mcgill.ca


rpkyle/cscmisc documentation built on May 13, 2019, 12:06 p.m.