# NOT RUN {
data("Adult")
## Mine frequent itemsets with Eclat.
fsets <- eclat(Adult, parameter = list(supp = 0.5))
## Display the 5 itemsets with the highest support.
fsets.top5 <- sort(fsets)[1:5]
inspect(fsets.top5)
## Get the itemsets as a list
as(items(fsets.top5), "list")
## Get the itemsets as a binary matrix
as(items(fsets.top5), "matrix")
## Get the itemsets as a sparse matrix, a ngCMatrix from package Matrix.
## Warning: for efficiency reasons, the ngCMatrix you get is transposed
as(items(fsets.top5), "ngCMatrix")
## Create a rules for the Adult dataset manually and calcualte some interest Measures
twoitemsets <- new("itemsets",
items = encode(list(
c("age=Young", "relationship=Unmarried"),
c("age=Old")
), itemLabels = itemLabels(Adult))
)
quality(twoitemsets) <- data.frame(support = interestMeasure(twoitemsets,
measure = c("support"), transactions = Adult))
inspect(twoitemsets)
# }
Run the code above in your browser using DataLab