# NOT RUN {
data("Adult")
## Mine rules
rules <- apriori(Adult, parameter = list(support = 0.3))
rules
## 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 = " ---> ")
## Create a rules for the Adult dataset manually and calcualte some interest Measures
twoRule <- new("rules",
lhs = encode(list(
c("age=Young", "relationship=Unmarried"),
c("age=Old")
), itemLabels = itemLabels(Adult)),
rhs = encode(list(
c("income=small"),
c("income=large")
), itemLabels = itemLabels(Adult))
)
quality(twoRule) <- interestMeasure(twoRule,
measure = c("support", "confidence", "lift"), transactions = Adult)
inspect(twoRule)
# }
Run the code above in your browser using DataLab