between: Between

Description Usage Arguments Details Value Examples

View source: R/between.R

Description

Determine if a numeric value is between the specified range

Usage

1
2
3
x %btwn% rng

between(x, rng, inclusive = TRUE)

Arguments

x

Numeric vector (or single value): the values to check if they're between rng.

rng

Two-element numeric cector: the range.

inclusive

Whether or not to include the lower and upper values of the range (default TRUE).

Details

x %btwn% rng is equivalent to between(x, rng, inclusive = TRUE).

Value

A logical vector of the same length as x.

For every element in x, return TRUE if the value lies within rng, and FALSE otherwise.

Examples

1
2
3
4
5 %btwn% c(1, 10)
c(5, 20) %btwn% c(5, 10)
between(5, c(5, 10))
between(5, c(5, 10), inclusive = FALSE)

daattali/rsalad documentation built on Oct. 28, 2019, 12:16 p.m.