rules-class {arules}R Documentation

Class “rules” - A Set of Rules

Description

The rules class represents a set of rules.

Objects from the Class

Objects are the result of calling the function apriori. Objects can also be created by calls of the form new("rules", ...).

Slots

lhs:
Object of class itemMatrix; the left-hand-sides of the rules (antecedents)
rhs:
Object of class itemMatrix; the right-hand-sides of the rules (consequents)
quality:
Object of class "data.frame"

Extends

Class associations, directly.

Methods

[
signature(x = "rules"); extracts a subset of rules and the associated quality measures
coerce
signature(from = "rules", to = "data.frame"); represents the set of rules as a data.frame
itemInfo
signature(object = "rules"); returns the whole item information data frame including item labels
labels
signature(object = "rules"); returns labels for the rules ("{lhs} => {rhs}") as a character vector
length
signature(x = "rules"); returns the number of rules stored in the the set
lhs
signature(x = "rules"); returns the itemMatrix representing the left-hand-side of the rules (antecedents)
lhs<-
signature(x = "rules"); replaces the itemMatrix representing the left-hand-side of the rules (antecedents)
rhs
signature(x = "rules"); returns the itemMatrix representing the right-hand-side of the rules (consequents)
rhs<-
signature(x = "rules"); replaces the itemMatrix representing the right-hand-side of the rules (consequents)
subset
signature(x = "rules"); selects a subset using restrictions on the quality measures or on the items present in the rules (see examples).
summary
signature(object = "rules")

Author(s)

Michael Hahsler

See Also

apriori, associations-class, itemMatrix-class,

Examples

data("Adult_transactions")

## Mine rules.
rules <- apriori(Adult_transactions, parameter = list(support = 0.4))

## Select a subset using an item in the right-hand-side
## and a quality measure
rules.sub <- subset(rules, subset = rhs %in% "sex" & lift > 1.3)

## Display rules.
inspect(SORT(rules.sub)[1:3])

[Package arules version 0.1-4 Index]