Visualizing association rules

Besides listing rules as text, you can visualize association rules, making it easier to find the relationship between itemsets. In the following recipe, we will introduce how to use the aruleViz package to visualize the association rules.

Getting ready

In this recipe, we will continue using the Groceries dataset. You need to have completed the previous recipe by generating the pruned rule rules.pruned.

How to do it...

Perform the following steps to visualize the association rule:

  1. First, you need to install and load the package arulesViz:
    > install.packages("arulesViz")
    > library(arulesViz)
    
  2. You can then make a scatter plot from the pruned rules:
    > plot(rules.pruned)
    

    The scatter plot of pruned association rules

  3. Additionally, ...

Get R: Recipes for Analysis, Visualization and Machine Learning 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.