| rules-class {arules} | R Documentation |
The rules class represents a set of rules.
Note that the class can also contain a collection of rules with duplicated
elements. Duplicated elements can be removed with unique.
Objects are the result of calling the function apriori.
Objects can also be created by calls of the form
new("rules", ...).
lhs:itemMatrix;
the left-hand-sides of the rules (antecedents)rhs:itemMatrix;
the right-hand-sides of the rules (consequents)quality:
Class associations, directly.
signature(from = "rules", to = "data.frame");
represents the set of rules as a data.framesignature(object = "rules");
returns the whole item information data frame including item
labelssignature(object = "rules");
returns the item labels used to encode the rulessignature(x = "rules");
returns for each rule the union of the items in the
lhs and rhs (i.e., the itemsets
which generated the rule) as a
the itemMatrixsignature(x = "rules");
returns a collection of the itemsets which generated the rules (one
itemset for each rule). Note that the collection can contain duplicated
elements. Use unique to remove duplicates and obtain a
proper set.signature(object = "rules");
returns labels for the rules ("{lhs} => {rhs}") as a
character vector. The representation can be customized using
the additional parameter ruleSep and parameters for label
defined in itemMatrixsignature(object = "rules");
returns the item labels as a character vector.
The index for each lable is the column index of the item in the
binary matrix.signature(x = "rules");
returns the itemMatrix
representing the left-hand-side of the rules (antecedents)signature(x = "rules");
replaces the itemMatrix
representing the left-hand-side of the rules (antecedents)signature(x = "rules");
returns the itemMatrix
representing the right-hand-side of the rules (consequents)signature(x = "rules");
replaces the itemMatrix
representing the right-hand-side of the rules (consequents)signature(object = "rules")
[-methods,
apriori,
c,
duplicated,
inspect,
length,
match,
sets,
size,
subset,
associations-class,
itemMatrix-class,
data("Adult")
## Mine rules.
rules <- apriori(Adult, parameter = list(support = 0.4))
## Select a subset of rules using partial matching on the items
## in the right-hand-side and a quality measure
rules.sub <- subset(rules, subset = rhs %pin% "sex" & lift > 1.3)
## Display rules.
inspect(SORT(rules.sub)[1:3])