Data analysis and preparation

As you may have noticed by looking at the data, there are a few things we need to do before we start building machine learning models. In this section, we are going to transform continuous variables that have monetary values and encode the target variable, Churn, as well as other categorical variables. To do so, perform the following steps:

  1. Handling missing values in the data: If you looked through the TotalCharges column in the dataset, you may have noticed that there are some records with no TotalCharges values. Since there are only 11 records with missing TotalCharges values, we are going to simply ignore and drop those records with missing values. Take a look at the following code:
        library(tidyr) df <- ...

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.