Skip to contents

Provides the generic functions and the methods for the set operations union(), intersect(), setequal(), setdiff() and is.element() on sets of associations (e.g., rules, itemsets) and itemMatrix.

Usage

# S3 method for class 'itemMatrix'
union(x, y, ...)

# S3 method for class 'associations'
union(x, y, ...)

# S4 method for class 'associations'
union(x, y, ...)

# S4 method for class 'itemMatrix'
union(x, y, ...)

# S3 method for class 'itemMatrix'
intersect(x, y, ...)

# S3 method for class 'associations'
intersect(x, y, ...)

# S4 method for class 'associations'
intersect(x, y, ...)

# S4 method for class 'itemMatrix'
intersect(x, y, ...)

# S3 method for class 'itemMatrix'
setequal(x, y, ...)

# S3 method for class 'associations'
setequal(x, y, ...)

# S4 method for class 'associations'
setequal(x, y, ...)

# S4 method for class 'itemMatrix'
setequal(x, y, ...)

# S3 method for class 'itemMatrix'
setdiff(x, y, ...)

# S3 method for class 'associations'
setdiff(x, y, ...)

# S4 method for class 'associations'
setdiff(x, y, ...)

# S4 method for class 'itemMatrix'
setdiff(x, y, ...)

# S3 method for class 'itemMatrix'
is.element(el, set, ...)

# S3 method for class 'associations'
is.element(el, set, ...)

# S4 method for class 'associations'
is.element(el, set, ...)

# S4 method for class 'itemMatrix'
is.element(el, set, ...)

Arguments

x, y, el, set

sets of associations or itemMatrix objects.

...

Other arguments are unused.

Value

union(), intersect(), setequal() and setdiff() return an object of the same class as x and y.

is.element() returns a logic vector of length el indicating for each element if it is included in set.

Details

Technical note: All S4 methods for set operations are defined for the class name "ANY" in the signature, so they should work for all S4 classes for which the following methods are available: match(), length() and unique().

Author

Michael Hahsler

Examples

data("Adult")

## mine some rules
r <- apriori(Adult)
#> Apriori
#> 
#> Parameter specification:
#>  confidence minval smax arem  aval originalSupport maxtime support minlen
#>         0.8    0.1    1 none FALSE            TRUE       5     0.1      1
#>  maxlen target  ext
#>      10  rules TRUE
#> 
#> Algorithmic control:
#>  filter tree heap memopt load sort verbose
#>     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
#> 
#> Absolute minimum support count: 4884 
#> 
#> set item appearances ...[0 item(s)] done [0.00s].
#> set transactions ...[115 item(s), 48842 transaction(s)] done [0.03s].
#> sorting and recoding items ... [31 item(s)] done [0.01s].
#> creating transaction tree ... done [0.02s].
#> checking subsets of size 1 2 3 4 5 6 7 8 9 done [0.09s].
#> writing ... [6137 rule(s)] done [0.00s].
#> creating S4 object  ... done [0.01s].

## take 2 subsets
r1 <- r[1:10]
r2 <- r[6:15]

union(r1, r2)
#> set of 15 rules 
intersect(r1, r2)
#> set of 5 rules 
setequal(r1, r2)
#> [1] FALSE