Let's plot and then see the sample dataset, sampdata
. From the output, it is clear that the number of transactions is around 100 and number of items is around 500. The following code also includes saving the output to a local file in the current working directory:
image(sampdata) dev.copy(png,filename="sampdata.png", width=600, height=875); dev.off ();
The output of the preceding command is as follows:
In the Adult
dataset, the number of transactions is huge; if the number of items were fewer, it would appear as a straight line.
In order to plot the rule, we need to load the arulesviz
package to the R environment. If this package is not already installed, use the install.packages
function to install it:
install.packages("arulesViz") library(arulesViz)
We can plot the rules using the plot
function. This plot will have the support and confidence in the x axis and y axis, respectively, and the shading is used to represent the lift. We can also change the representation using...