March 2019
Beginner to intermediate
464 pages
10h 57m
English
The first thing we are going to do is encode the response variable, Response. We are going to encode Yes values with 1s and No values with 0s. Take a look at the following code:
## 2.1. Response Variable: Responsedf$Engaged <- as.integer(df$Response) - 1
As you can see from this code, we are simply casting the values of the Response column to integer values using the as.integer function. The reason why we are subtracting by 1 is because it encodes values into 1 for No and 2 for Yes, instead of 0 for No and 1 for Yes, as we wanted. We then store these encoded values in a newly-created column, Engaged. In order to get the overall response or engagement rate using this newly-created column, you can use the following ...
Read now
Unlock full access