grapes-wi-grapes: Within

%wi%R Documentation

Within

Description

Here's a very handy "within" range. Checks whether a number is within a range. Capable of handling lists so that it can apply to a whole column. Basically I got tired of running a two-part conditional when I wanted something that was within a range: if (x > 2 & x < 5).

Usage

x %wi% range

Arguments

x

A numeric vector.

range

A numeric vector. The highest and lowest values will be used as the range.

Value

A logical vector.

Examples

4 %wi% c(1,5)
c(2, 3) %wi% c(1,5)
c(1:5) %wi% c(4,6)

JoeyStanley/joeyr documentation built on April 7, 2023, 8:37 p.m.