Last data update: 2014.03.03

R: Interval Class
intervalR Documentation

Interval Class

Description

interval constructs an object of class interval representing an interval.

liesWithin checks if a number lies within a given interval.

Usage

interval(lower, upper, left=c(">=", ">"), right=c("<=", "<"))

liesWithin(x, int)

Arguments

lower

the lower boundary of the interval. Can be set to -Inf.

upper

the upper boundary of the interval. Can be set to Inf.

left, right

a comparison symbol. Must be one of (“>=”, “>”) for left and (“<=”, “<”) for right, respectively. Determines whether the boundary values are included in the interval or not. The default is “>=” and “<=”, respectively.

x

a numeric vector or array giving the numbers to be checked.

int

an interval object.

Value

interval returns an object of class interval containing the following components:

lower

the lower boundary of the interval

upper

the upper boundary of the interval

left

the left comparison operator

right

the right comparison operator

liesWithin returns TRUE if the given number lies within the interval and FALSE otherwise.

Author(s)

Thorn Thaler

Examples


i <- interval(-3, 3, left=">")

liesWithin(-3:5, i)

Results