is.within: Test if number is within given interval

View source: R/is.within.R

is.withinR Documentation

Test if number is within given interval

Description

is.within tests if object x is within interval.

Usage

is.within(x, interval, open.interval = FALSE)

Arguments

x

A numeric x, vector or list.

interval

The (numeric) interval within which x is being tested.

open.interval

logical: should interval be regarded as an open interval?

Details

This function tests if the given value is contained within a (possibly open) given interval.

Value

The default method for is.within applied to an atomic vector returns a logical vector of the same length as its argument x, containing TRUE for those elements contained within interval, and FALSE otherwise.

Author(s)

Felipe Figueiredo

Examples

is.within(1.5, c(0,5)) # TRUE
is.within(6, c(0,5)) # FALSE

is.within(c(1.5, 6), c(0,5)) # vector: TRUE, TRUE
is.within(list(1.5, 6), c(0,5)) # list: TRUE, FALSE


philsf/philsfmisc documentation built on April 11, 2022, 9:04 p.m.