Skip to content
Comparing All 3 Variables in one Visualization
  • AI Chat
  • Code
  • Report
  • Where to focus a marketing campaign?

    💪 Challenge

    Create a single visualization that the marketing manager can use to explore the data. Include:

    1. What are the top three categories in terms of total donations?
    2. What device type has historically provided the most contributions?
    3. What age bracket should the campaign target?

    Read data

    library(tidyverse)
    theme_set(theme_bw())
    df <- readr::read_csv('./data/crowdfunding.csv')
    head(df)

    Checking best performing subgroup

    df %>%
      group_by(category, device, age) %>%
      summarize(amount = sum(amount)) %>%
      arrange(-amount)

    The Visualization

    df %>%
      group_by(category, device, age) %>%
      summarize(amount = sum(amount)) %>%
      ggplot(aes(amount, fct_relevel(category,"Technology", "Sports", "Fashion",
                                              "Environment", "Games"),
                 fill = fct_rev(age))) + 
      geom_col(color = "black", position = "dodge") + 
      labs(y = "", x = "Contribution", fill = "Age", 
           title = "Contributions by Subgroup") + 
      theme(plot.title = element_text(hjust = 0.5)) +
      scale_x_continuous(breaks = seq(0,50000, 10000),
                         labels = scales::comma) +
      facet_wrap(~ fct_rev(device), ncol = 1)