Description Usage Arguments Details Value See Also Examples
View source: R/operation_setintersect.R
Returns the intersection of two objects inheriting from class Set
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | setintersect(x, y)
## S3 method for class 'Interval'
setintersect(x, y)
## S3 method for class 'ConditionalSet'
setintersect(x, y)
## S3 method for class 'UnionSet'
setintersect(x, y)
## S3 method for class 'ComplementSet'
setintersect(x, y)
## S3 method for class 'ProductSet'
setintersect(x, y)
## S3 method for class 'Set'
x & y
|
x, y |
Set |
The intersection of two sets, X, Y, is defined as the set of elements that exist in both sets,
{z : z ε X and z ε Y}
In the case where no elements are common to either set, then the empty set is returned.
The intersection of two ConditionalSets is defined by combining their defining functions by an
'and', &
, operator. See examples.
The intersection of fuzzy and crisp sets first coerces fuzzy sets to crisp sets by finding their support.
A Set
consisting of elements in both x
and y
.
Other operators:
powerset()
,
setcomplement()
,
setpower()
,
setproduct()
,
setsymdiff()
,
setunion()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # intersection of two sets
Set$new(-2:4) & Set$new(2:5)
setintersect(Set$new(1, 4, "a"), Set$new("a", 6))
Set$new(1:4) & Set$new(5:7)
# intersection of two intervals
Interval$new(1, 10) & Interval$new(5, 15)
Interval$new(1, 2) & Interval$new(2, 3)
Interval$new(1, 5, class = "integer") &
Interval$new(2, 7, class = "integer")
# intersection of mixed set types
Set$new(1:10) & Interval$new(5, 15)
Set$new(5, 7) & Tuple$new(6, 8, 7)
# Ignores membership of FuzzySet
FuzzySet$new(1, 0.1, 2, 0.5) & Set$new(2:5)
# intersection of conditional sets
ConditionalSet$new(function(x, y) x >= y) &
ConditionalSet$new(function(x, y) x == y)
ConditionalSet$new(function(x) x == 2) &
ConditionalSet$new(function(y) y == 3)
# But be careful not to make an empty set
ConditionalSet$new(function(x) x == 2) &
ConditionalSet$new(function(x) x == 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.