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 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.