O'Reilly logo

Learning Predictive Analytics with R by Eric Mayor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

Using apriori for basic analysis

Running apriori on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required