Conversions by age and marital status

So far, we have aggregated our data by one criterion. However, there are cases where you want to group the data by more than one column. In this section, we will discuss how we can analyze and report conversion rates by more than one criterion. As an exercise, we will use the age groups that we have built in the previous section and the marital status as the two columns to group by.

Let's first look at the code:

#### 5. Conversions by Age Groups & Marital Status ####conversionsByAgeMarital <- conversionsDF %>%   group_by(AgeGroup=cut(age, breaks= seq(20, 70, by = 10)), Marital=marital) %>%   summarise(Count=n(), NumConversions=sum(conversion)) %>%  mutate(TotalCount=sum(Count)) %>% mutate(ConversionRate=NumConversions/TotalCount) ...

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.