Description Usage Arguments Details Value See Also Examples
View source: R/operation_setcomplement.R
Returns the set difference of two objects inheriting from class Set
. If y
is missing
then the complement of x
from its universe is returned.
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 | setcomplement(x, y, simplify = TRUE)
## S3 method for class 'Set'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'Interval'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'FuzzySet'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'ConditionalSet'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'Reals'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'Rationals'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'Integers'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'ComplementSet'
setcomplement(x, y, simplify = TRUE)
## S3 method for class 'Set'
x - y
|
x, y |
Set |
simplify |
logical, if |
The difference of two sets, X, Y, is defined as the set of elements that exist in set X and not Y,
X-Y = {z : z ε X and !(z ε Y)}
The set difference of two ConditionalSets is defined by combining their defining functions by a negated
'and', !&
, operator. See examples.
The complement of fuzzy and crisp sets first coerces fuzzy sets to crisp sets by finding their support.
An object inheriting from Set
containing the set difference of elements in x
and y
.
Other operators:
powerset()
,
setintersect()
,
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 34 | # absolute complement
setcomplement(Set$new(1, 2, 3, universe = Reals$new()))
setcomplement(Set$new(1, 2, universe = Set$new(1, 2, 3, 4, 5)))
# complement of two sets
Set$new(-2:4) - Set$new(2:5)
setcomplement(Set$new(1, 4, "a"), Set$new("a", 6))
# complement of two intervals
Interval$new(1, 10) - Interval$new(5, 15)
Interval$new(1, 10) - Interval$new(-15, 15)
Interval$new(1, 10) - Interval$new(-1, 2)
# complement of mixed set types
Set$new(1:10) - Interval$new(5, 15)
Set$new(5, 7) - Tuple$new(6, 8, 7)
# FuzzySet-Set returns a FuzzySet
FuzzySet$new(1, 0.1, 2, 0.5) - Set$new(2:5)
# Set-FuzzySet returns a Set
Set$new(2:5) - FuzzySet$new(1, 0.1, 2, 0.5)
# complement of conditional sets
ConditionalSet$new(function(x, y, simplify = TRUE) x >= y) -
ConditionalSet$new(function(x, y, simplify = TRUE) x == y)
# complement of special sets
Reals$new() - NegReals$new()
Rationals$new() - PosRationals$new()
Integers$new() - PosIntegers$new()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.