Learn R Programming

arules (version 1.7-6)

sets: Set Operations

Description

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 itemMatrix
union(x, y, ...)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

Arguments

x, y, el, set

sets of associations or itemMatrix objects.

...

Other arguments are unused.

Author

Michael Hahsler

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().

See Also

Other associations functions: abbreviate(), associations-class, c(), duplicated(), extract, inspect(), is.closed(), is.generator(), is.maximal(), is.redundant(), is.significant(), is.superset(), itemsets-class, match(), rules-class, sample(), size(), sort(), unique()

Other itemMatrix and transactions functions: abbreviate(), crossTable(), c(), duplicated(), extract, hierarchy, image(), inspect(), is.superset(), itemFrequencyPlot(), itemFrequency(), itemMatrix-class, match(), merge(), random.transactions(), sample(), size(), supportingTransactions(), tidLists-class, transactions-class, unique()

Examples

Run this code
data("Adult")

## mine some rules
r <- apriori(Adult)

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

union(r1, r2)
intersect(r1, r2)
setequal(r1, r2)

Run the code above in your browser using DataLab