Learn R Programming

arules (version 1.5-0)

rules-class: Class ``rules'' --- A Set of Rules

Description

The rules class represents a set of rules.

Note that the class can also represent a multiset of rules with duplicated elements. Duplicated elements can be removed with unique.

Arguments

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

Extends

Class associations, directly.

Methods

See Also

[-methods, apriori, c, duplicated, inspect, length, match, sets, size, subset, associations-class, itemMatrix-class,

Examples

Run this code
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 the top 3 support rules
inspect(head(rules.sub, n = 3, by = "support"))

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

## Get labels for the first 3 rules
labels(rules.sub[1:3])
labels(rules.sub[1:3], itemSep = " + ", setStart = "", setEnd="", 
  ruleSep = " ---> ")

Run the code above in your browser using DataLab