Get startedGet started for free

Single basket

In the following exercises, you will be working with a dataset containing transactions of an e-commerce retail company based in the UK. These transactions consist of all transactions in the first quarter of 2011.

You will in particular have a closer look at a single basket from this dataset. It will be your turn to figure out the total basket size and the number of distinct products.

The dataset called Online_Retail_2011_Q1 is available in your workspace. Some important columns of the dataset are:

  • StockCode: number uniquely assigned to each distinct product;
  • InvoiceNo: number uniquely assigned to each transaction;
  • Description: description of the product;
  • Quantity: quantity purchased per transaction.

This exercise is part of the course

Market Basket Analysis in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Have a glimpse at the dataset
glimpse(Online_Retail_2011_Q1)

# Filter a single basket
One_basket = Online_Retail_2011_Q1 %>%
				___(___ == 540180)

___(___)
Edit and Run Code