2.5. Response rates by occupation categories and incentive groups (Figure 2)


#ggplot
# Job
toPlot <-
  WaveOne[WaveOne$id.bru==1,
              c("rr", "job", "Pumavers")] %$%
  #mutate(bin = cut(job, pretty(job, 20))) %$%
  table(job, rr, Pumavers) %>%
  as.data.frame() %>%
  mutate(plotVal = ifelse(rr == "Response",-1 * (Freq / table(WaveOne$rr)[["Response"]]),
                          Freq / table(WaveOne$rr)[["Non-Response"]]))

levels(toPlot$rr)[1] <- "Nonresponse"
levels(toPlot$Pumavers) <- c("Brochure",
                             "2€ token",
                             "5€ token",
                             "Voucher")

toPlot %>%
  ggplot(aes(job, y = Freq)) +
  geom_bar(aes(fill = rr), position = "fill", stat = "identity") +
  coord_flip() +
  geom_hline(aes(yintercept = 0.247, 
                 linetype = "Overall Response Rate (24.7%)"),
             show.legend = TRUE) +
  scale_y_continuous(labels  = scales::percent_format(accuracy = 1),
                     breaks = c(0,0.2, 0.4, 0.6, 0.8,1)) +
  facet_grid(. ~ Pumavers) +
  scale_x_discrete(
    labels = function(x)
      str_wrap(x, width = 30)
  ) +
  labs(y = "", x = "Occupation") +
  scale_fill_manual(values = c("grey", "grey50")) +
  guides(fill = guide_legend(title = NULL,
                             override.aes = list(linetype = 0))) +
  scale_linetype_manual(" ", values = 1)+
  theme_minimal() +
  theme(legend.position = "top") +
  theme(text=element_text(size=12#, family="serif"
  ))

plot of chunk unnamed-chunk-44

Previous
Next