The arule
package uses its own transactions
class to store transaction data. As such, we must use the generic function provided by arule
to display transactions and association rules. In this recipe, we will illustrate how to display transactions and association rules via various functions in the arule
package.
Ensure that you have completed the previous recipe by generating transactions and storing these in the trans
variable.
Perform the following steps to display transactions and associations:
- First, you can obtain a
LIST
representation of the transaction data:
> LIST(trans) Output $Tr1 [1] "Apple" "Bread" "Cake" $Tr2 [1] "Apple" "Bread" "Milk" $Tr3 [1] "Bread" "Cake" "Milk"
- Next, you can use the
summary
function to show a summary of the statistics and details of the transactions:
> summary(trans) Output transactions...