setunion: Union of Sets

Description Usage Arguments Details Value See Also Examples

View source: R/operation_setunion.R

Description

Returns the union of objects inheriting from class Set.

Usage

1
2
3
4
5
6
7
setunion(..., simplify = TRUE)

## S3 method for class 'Set'
x + y

## S3 method for class 'Set'
x | y

Arguments

...

Sets

simplify

logical, if TRUE (default) returns the result in its simplest (unwrapped) form, usually a Set, otherwise a UnionSet.

x, y

Set

Details

The union of N sets, X1, ..., XN, is defined as the set of elements that exist in one or more sets,

U = {x : x ε X1 or x ε X2 or ... or x ε XN}

The union of multiple ConditionalSets is given by combining their defining functions by an 'or', |, operator. See examples.

The union of fuzzy and crisp sets first coerces fuzzy sets to crisp sets by finding their support.

Value

An object inheriting from Set containing the union of supplied sets.

See Also

Other operators: powerset(), setcomplement(), setintersect(), setpower(), setproduct(), setsymdiff()

Examples

 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
# union of Sets

Set$new(-2:4) + Set$new(2:5)
setunion(Set$new(1, 4, "a"), Set$new("a", 6))
Set$new(1, 2) + Set$new("a", 1i) + Set$new(9)

# union of intervals

Interval$new(1, 10) + Interval$new(5, 15) + Interval$new(20, 30)
Interval$new(1, 2, type = "()") + Interval$new(2, 3, type = "(]")
Interval$new(1, 5, class = "integer") +
  Interval$new(2, 7, class = "integer")

# union of mixed types

Set$new(1:10) + Interval$new(5, 15)
Set$new(1:10) + Interval$new(5, 15, class = "integer")
Set$new(5, 7) | Tuple$new(6, 8, 7)

# union of FuzzySet
FuzzySet$new(1, 0.1, 2, 0.5) + Set$new(2:5)

# union of conditional sets

ConditionalSet$new(function(x, y) x >= y) +
  ConditionalSet$new(function(x, y) x == y) +
  ConditionalSet$new(function(x) x == 2)

# union of special sets
PosReals$new() + NegReals$new()
Set$new(-Inf, Inf) + Reals$new()

set6 documentation built on Oct. 18, 2021, 5:06 p.m.