O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inspecting the transaction file

Once the data has been coerced to transaction form, we can use the inspect function to examine the data.

When inspecting transaction files, you do not use normal print, or head functions directly, since the objects are in sparse format. You use an inspect() function instead.

If you happen to have the tm package loaded (which we will use later), you must preface inspect with arules::inspect, since there is also an inspect function in the tm package that serves a different purpose.

If you run an inspect command on the first five records, you can see that the data is in basket format, that is, each invoice shows the itemsets, delimited by {}, that are associated with each invoice:

 arules::inspect(trans4[1:5]) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required