grapes-e-grapes: Element In Set Operator

%e%R Documentation

Element In Set Operator

Description

This operator allows use of set notation style definitions

Usage

e1 %e% e2

Arguments

e1

The values to be operated on, on the left hand side

e2

A character string containing set notation style defined ranges on the real number line. Separate sets with the “&” or “|” operator for AND or OR.

Value

a logical vector

Examples


c(-1, 0, 1, 9, 10, 16, 17, 20) %e% "(-Inf, 0) | [1, 9) | [10, 16] | (17, Inf]"
table(mtcars$mpg %e% "(0, 15.5) | [22.8, 40)")
table(mtcars$mpg %e% "(0, 15) | [16, 18] | [30, 50)")
c(-1, 0, 1) %e% "(-Inf, Inf) & [0, 0] | [1, 1]"

z <- max(mtcars$mpg)
table(mtcars$mpg %e% "(-Inf, z)")

## clean up
rm(z)

JWiley/extraoperators documentation built on Jan. 27, 2024, 9:39 a.m.