is_between: Is between

Description Usage Arguments Details Author(s) Examples

View source: R/is_between.R

Description

\Sexpr[results=rd, stage=render]{lifecycle::badge("experimental")}

Tests if x is between lower and upper. By default, the limits are not included.

Usage

1
is_between(x, lower, upper, include_limits = FALSE, allow_na = TRUE)

Arguments

x

Number(s) to test. (Numeric)

lower

Lower limit. (Numeric)

upper

Upper limit. (Numeric)

include_limits

Whether to include limits in the allowed values for x. (Logical)

allow_na

Whether to allow x to contain NAs.

Details

When include_limits is FALSE: x > lower & x < upper

When include_limits is TRUE: x >= lower & x <= upper

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

Examples

1
2
3
4
5
6
7
8
9
# Attach packages
library(rtilities2)

is_between(3, 1, 5) # TRUE
is_between(-1, 1, 5) # FALSE
is_between(1, 1, 5) # FALSE
is_between(1, 1, 5, include_limits = TRUE) # TRUE
is_between(5, 1, 5) # FALSE
is_between(5, 1, 5, include_limits = TRUE) # TRUE

LudvigOlsen/rtilities2 documentation built on Jan. 19, 2020, 4:57 a.m.