Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is.superset

Find Super and Subsets


Description

Provides the generic functions and the S4 methods is.subset and is.superset for finding super or subsets in associations and itemMatrix objects.

Usage

is.subset(x, y = NULL, proper = FALSE, sparse = TRUE, ...)
is.superset(x, y = NULL, proper = FALSE, sparse = TRUE, ...)

Arguments

x, y

associations or itemMatrix objects. If y = NULL, the super or subset structure within set x is calculated.

proper

a logical indicating if all or just proper super or subsets.

sparse

a logical indicating if a sparse (ngCMatrix) rather than a dense logical matrix sgould be returned. Sparse computation preserves a significant amount of memory and is much faster for large sets.

...

currently unused.

Details

looks for each element in x which elements in y are supersets or subsets. Note that the method can be very slow and memory intensive if x and/or y contain many elements.

For rules, the union of lhs and rhs is used a the set of items.

Value

returns a logical matrix or a sparse ngCMatrix (for sparse=TRUE) with length(x) rows and length(y) columns. Each logical row vector represents which elements in y are supersets (subsets) of the corresponding element in x. If either x or y have length zero, NULL is returned instead of a matrix.

Author(s)

Michael Hahsler and Ian Johnson

See Also

Examples

data("Adult")
set <- eclat(Adult, parameter = list(supp = 0.8))

### find the supersets of each itemset in set
is.superset(set, set)
is.superset(set, set, sparse = FALSE)

arules

Mining Association Rules and Frequent Itemsets

v1.6-7
GPL-3
Authors
Michael Hahsler [aut, cre, cph], Christian Buchta [aut, cph], Bettina Gruen [aut, cph], Kurt Hornik [aut, cph], Ian Johnson [ctb, cph], Christian Borgelt [ctb, cph]
Initial release
2021-03-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.