sets: Binary Operators for Set Relations

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

These functions test set relations using binary operators. See details.

Usage

1
2
3
4
5
6
7
8
## Default S3 method:
x %+% y
## Default S3 method:
x %&% y
## Default S3 method:
x %-% y
## S3 method for class 'keyed'
as.vector(x,mode='any')

Arguments

x

left operand

y

right operand

mode

currently ignored

Details

The function %+% and its alias %u% give set union, with obvious mnemonic significance. %&% gives set intersection; mnemonically, elements present in x and y. n looks like an inverted u in many fonts, so %n% gives set intersection in something more like classical notation. %-% is suggestive of set difference both in arithmetic and classical notation.

These functions call union, intersect, and setdiff, which coerce their arguments to vector. For convenience, as.vector.keyed is defined to return just the names of a keyed data frame – frequently these are subject to set manipulations.

Value

vector

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

1
2
3
4
c('a','b','c') %u% c('c','d','e')
c('a','b','c') %n% c('c','d','e')
c('a','b','c') %-% c('c','d','e')
as.vector(as.keyed(Theoph,c('Subject', 'Time')))

metrumrg documentation built on May 2, 2019, 5:55 p.m.