ein: Exists and (not) in

Description Usage Arguments Value Examples

Description

A common blunder in R programming is to mistype one of a set of filters without realizing. This function will error if any member of the values to be matched against is not present.

Usage

1
2
3
lhs %ein% rhs

lhs %enotin% rhs

Arguments

lhs

Values to be matched

rhs

Values to be matched against.

Value

Same as %in% and %notin%, unless an element of rhs is not present in lhs, in which case, an error.

Examples

1
2
3
4
5
6
7
# Incorrectly assumed to include two Species
iris[iris$Species %in% c("setosa", "versicolour"), ]
## Not run: 
# Error:
iris[iris$Species %ein% c("setosa", "versicolour"), ]

## End(Not run)

hutils documentation built on Aug. 20, 2018, 9:04 a.m.