sets: Set Operations

setsR Documentation

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

## S4 method for signature '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 signature 'associations'
is.element(el, set, ...)

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

Arguments

x, y, el, set

sets of associations or itemMatrix objects.

...

Other arguments are unused.

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

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.

Author(s)

Michael Hahsler

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(), c(), crossTable(), duplicated(), extract, hierarchy, image(), inspect(), is.superset(), itemFrequency(), itemFrequencyPlot(), itemMatrix-class, match(), merge(), random.transactions(), sample(), size(), supportingTransactions(), tidLists-class, transactions-class, unique()

Examples

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)


arules documentation built on Sept. 11, 2024, 8:15 p.m.