Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Science for Marketing

You're reading from   Hands-On Data Science for Marketing Improve your marketing strategies with machine learning using Python and R

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781789346343
Length 464 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Yoon Hyup Hwang Yoon Hyup Hwang
Author Profile Icon Yoon Hyup Hwang
Yoon Hyup Hwang
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Section 1: Introduction and Environment Setup FREE CHAPTER
2. Data Science and Marketing 3. Section 2: Descriptive Versus Explanatory Analysis
4. Key Performance Indicators and Visualizations 5. Drivers behind Marketing Engagement 6. From Engagement to Conversion 7. Section 3: Product Visibility and Marketing
8. Product Analytics 9. Recommending the Right Products 10. Section 4: Personalized Marketing
11. Exploratory Analysis for Customer Behavior 12. Predicting the Likelihood of Marketing Engagement 13. Customer Lifetime Value 14. Data-Driven Customer Segmentation 15. Retaining Customers 16. Section 5: Better Decision Making
17. A/B Testing for Better Marketing Strategy 18. What's Next? 19. Other Books You May Enjoy

Segmenting customers with R

In this section, we are going to discuss how to segment the customer base into subgroups using a clustering algorithm in R. By the end of this section, we will have built a customer segmentation model using the k-means clustering algorithm. For those readers who would like to use Python, instead of R, for this exercise, see the previous section.

For this exercise, we will be using one of the publicly available datasets from the UCI Machine Learning Repository, which can be found at this link: http://archive.ics.uci.edu/ml/datasets/online+retail. You can follow this link and download the data, which is available in XLSX format, named Online Retail.xlsx. Once you have downloaded this data, you can load it into your RStudio by running the following command:

library(readxl)

#### 1. Load Data ####
df <- read_excel(
path="~/Documents/data-science...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime