Displaying transactions and associations
The arules
package uses its transactions
class to store transaction data. As such, we must use the generic function provided by arules
to display transactions and association rules. In this recipe, we illustrate how to plot transactions and association rules with various functions in the arules
package.
Getting ready
Ensure you have completed the previous recipe by generating transactions and storing these in a variable named trans
.
How to do it…
Perform the following steps to display transactions and associations:
First, obtain a
LIST
representation of the transaction data:> head(LIST(trans),3) $'00001' [1] "P0014520085" $'00002' [1] "P0018800250" $'00003' [1] "P0003926850034" "P0013344760004" "P0013834251" "P0014251480003"
Next, use the
summary
function to show a summary of the statistics and details of the transactions:> summary(trans) transactions as itemMatrix in sparse format with 32539 rows (elements/itemsets/transactions) and 20054...