grapes-between-grapes: Test if numbers are within a specified range

%between%R Documentation

Test if numbers are within a specified range

Description

Test if a vector of numbers is inside of a specified range, with the bounds optionally included.

Usage

x %between% rng

`%between%`(x, rng, inc_bounds = FALSE)

Arguments

x

numeric vector to be tested.

rng

vector of minimum and maximum values of the range. Elements beyond the first 2 are ignored.

inc_bounds

logical, whether to include the bounds in the set that is tested. If set to TRUE, values identical to the bounds are considered matches. Defaults to FALSE. Works only if the function is not used as an infix operator (see usage example below).

Value

a logical vector with one element for each element in x


mjdufort/miscHelpers documentation built on Feb. 4, 2024, 7:44 p.m.