Trending items over time

So far, we have analyzed the overall time series patterns and how customers engage with the overall business, but not how customers engage with individual products. In this section, we are going to explore and analyze how customers interact with individual products that are sold. More specifically, we will take a look at the trends of the top five best-sellers over time.

The first task for analyzing the time series trending items is to count the number of items sold for each product for each period. Take a look at the following code:

popularItems <- df %>%  group_by(InvoiceDate=floor_date(InvoiceDate, "month"), StockCode) %>%  summarise(Quantity=sum(Quantity))

As you can notice from this code, we are grouping the data ...

Get Hands-On Data Science for Marketing 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.