March 2019
Beginner to intermediate
464 pages
10h 57m
English
The first thing that we are going to look at is the aggregate engagement rate. This engagement rate is simply the percentage of customers who responded to the marketing calls. Take a look at the following code:
engagementRate <- df %>% group_by(Engaged) %>% summarise(Count=n()) %>% mutate(Percentage=Count/nrow(df)*100.0)
As you can see in this code, we are grouping by the newly created field, Engaged, using the group_by function. Then, we are counting the number of records or customers in each Engaged group with the n() function. By dividing by the total number of customers in the DataFrame, df, and multiplying by 100.0, we get the engagement rate. The results look as follows:
To make it easier to read, we can transpose ...
Read now
Unlock full access