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:
![](https://static.packt-cdn.com/products/9781782169352/graphics/9352OS_07_1a.jpg)
Running apriori on the Groceries dataset with default parameters
We can see on the first line the parameters used in the analysis—in this case, the default. Around the middle of the output (where the arrow is), we see that there are 169
items in 9835
transactions in this dataset, and that 0
rules have been found (see second to last line). If you try this with your own...