outside: Negation of %between% Operator

Description Usage Arguments Value Examples

Description

R (data.table) lacks a negation of the %between% operator. While you can negate the whole expression, that solution results in less readable and clear code.

Usage

1
2
3
4
5
outside(.x, .lower, .upper, .incbounds = TRUE)

.x %outside% .bounds

.x %notbetween% .bounds

Arguments

.x

Numeric vector. Input data

.lower

Numeric value or vector with the lower bound(s)

.upper

Numeric value or vector with the upper bound(s)

.incbounds

TRUE means inclusive bounds, i.e. lower <= .x <= .upper. FALSE means exclusive bounds. For %outside% .incbounds = TRUE is used.

Value

Logical vector of same length as .x. TRUE if the input value is outside the bounds, FALSE otherwise.

Examples

1
rnorm(10) %outside% c(-0.5, 0.5)

STAT-UP/statupinternal documentation built on May 9, 2019, 11:43 a.m.