How to do it...

Perform the following steps to display transactions and associations:

  1. 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"
  1. Next, you can use the summary function to show a summary of the statistics and details of the transactions:
        > summary(trans)        Output        transactions as itemMatrix in sparse format with         3 rows (elements/itemsets/transactions) and         4 columns (items) and a density of 0.75         most frequent items:         Bread Apple Cake Milk (Other)            3    2     2    2     0          element (itemset/transaction) length distribution:        sizes        3         3            Min. 1st Qu. Median Mean 3rd Qu. Max.             3     3       3     3    3       3  includes extended item information ...

Get Machine Learning with R Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.