within: within boundaries

View source: R/within.R

withinR Documentation

within boundaries

Description

Compare a vector within (between) other values

Usage

between_more(x, left, right, type = c("gele", "gel", "gle", "gl"))

within(x, left = NULL, right = NULL, bounds = c("[]", "[)", "(]", "()"))

Arguments

x

A numeric vector of values

left, right

Boundary values. For within(), when NULL no comparison is made for that boundary. When both are NULL, x is just returned.

type

Abbreviation for the evaluation of left on right (see details)

bounds

Boundaries for comparisons of left and right (see details)

Details

⁠type``, ⁠bounds“ can be one of the below:

g,(

is greater than (>)

ge,[

greater than or equal to (>=)

l,))

less than (<)

le,[]

less than or equal to (<=)

Note: between_more() may be deprecated in the future in favor of just within()

Value

A logical vector

Examples


between_more(2:10, 2, 10, "gl")
within(2:10, 2, bounds = "()")
between_more(10, 2, 10, "gle")
within(2:10, bounds = "(]")
within(1:5, c(3, 3, 2, 2, 1), 5)

mark documentation built on April 3, 2025, 6:41 p.m.