Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Load and explore data. Conduct simple data analysis.
Check data quality – NAs and imputation
Define customer activity levels
11. Check customers activity


Well done!

Now that we've taken care of some basic data quality issues, we can begin defining customer activity levels.

A customer can be classified as highly active (HIGH), moderately active (MEDIUM), somewhat active (LOW), or completely inactive, based on how frequently they purchase items from our stores and how much money they spend with us.


Let's create a character column named activity in the customers data frame. We'll define our customer activity levels as follows:

  • HIGH – customers who bought products from 3 categories in the last 6 months and spent more than 12000 in the last 6 months.
  • MEDIUM – customers who are not highly active and who spent more than 8000 within the last 6 months.
  • LOW – customers who are not moderately active and who spent more than 3000 within the last 6 months.
  • INACTIVE – all other customers.

Make column activity a factor with levels: HIGH, MEDIUM, LOW, INACTIVE, in that order.