Analyzing data with apriori in R
In this section, we will continue with another supermarket example and analyze associations in the Groceries
dataset. In order to use this dataset and to explore association rules in R, we need to install and load the arules
package:
install.packages("arules") library(arules) data(Groceries)
Using apriori for basic analysis
We can now explore relationships between purchased products in this dataset. This dataset is already in a form exploitable by apriori
(transactions). We will first use the default parameters as follows:
rules = apriori(Groceries)
The output is provided in the following screenshot:
Get R: Predictive Analysis now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.