inRange: Test whether a number lies within range [a,b]

View source: R/ranges.R

inRangeR Documentation

Test whether a number lies within range ⁠[a,b]⁠

Description

Default values of ⁠a=0; b=1⁠ allow for quick test if x is a probability.

Usage

inRange(x, a = 0, b = 1)

Arguments

x

values to be tested

a

lower bound (default 0)

b

upper bound (default 1)

Value

Logical vectors. NA values in x are retained.

Author(s)

Alex Chubaty

Examples

set.seed(100)
x <- stats::rnorm(4) ## -0.50219235  0.13153117 -0.07891709  0.88678481
inRange(x, 0, 1)     ## FALSE  TRUE FALSE  TRUE


achubaty/amc documentation built on June 10, 2025, 1:10 p.m.