grapes-e-grapes: Element In Set Operator

Description Usage Arguments Value Examples

Description

This operator allows use of set notation style definitions

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

extraoperators documentation built on Nov. 5, 2019, 1:07 a.m.