PC

Attendance

att <- data.frame(stringsAsFactors=FALSE,
                  age = c("Millennials", "Gen X", "Boomers", "Elders"),
                  "2003" = c("39%", "34%", "45%", "51%"),
                  "2019" = c("24%", "31%", "35%", "41%")
) %>% 
  as_tibble() 


left <- att %>% 
  select(age, year = X2003) %>% 
  mutate(pct = gsub("%", "", .$year)) %>% 
  mutate(pct = as.numeric(pct)/100)


right <- att %>% 
  select(age, year = X2019) %>% 
  mutate(pct = gsub("%", "", .$year)) %>% 
  mutate(pct = as.numeric(pct)/100)


left_label <- paste(left$age, left$year, sep = ": ")
right_label <- paste(right$age, right$year, sep = ": ")

sl <- bind_cols(left, right)


ggplot(sl) +
  geom_segment(aes(x=1, xend =2, y = pct, yend = pct1, col= age), size = .75, show.legend = FALSE, linetype = "twodash") +
  scale_y_continuous(labels = percent, limits = c(.23, .53)) +
  geom_vline(xintercept=1, linetype="dashed", size=.1) + 
  geom_vline(xintercept=2, linetype="dashed", size=.1) +
  xlim(.25, 2.75) + 
  scale_color_tableau() +
  geom_text(label=left_label, y=sl$pct, x=rep(1, NROW(sl)), hjust=1.05, size=4.5, family = "font") +
  geom_text(label=right_label, y=sl$pct1, x=rep(2, NROW(sl)), hjust=-0.05, size=4.5, family = "font") +
  geom_text(label="2003", x=1, y=.525, hjust=1.1, size=5, family = "font") +
  geom_text(label="2019", x=2, y=.525, hjust=-.1, size=5, family = "font") +
  theme_gg("Abel") +
  theme(panel.background = element_blank(), 
        panel.grid = element_blank(), 
        axis.ticks = element_blank(), 
        axis.text.x = element_blank(), 
        panel.border = element_blank()) +
  labs(x = "", y = "", title = "Weekly Attendance by Generation", caption = "") 

Bible

These don’t sum up to 100% in 2011 or 2019 because of rounding issues.

bible <- data.frame(stringsAsFactors=FALSE,
                    freq = c("Never", "Less than once a year", "Once or twice a year",
                             "Three or four times a year", "Once a month", "Once a week",
                             "Several times/4+ times a week", "Every day", "Not sure"),
                    NA2011 = c("25", "13", "11", "8", "8", "8", "15", "11", "3"),
                    NA2012 = c("26", "10", "10", "9", "8", "7", "13", "13", "5"),
                    NA2013 = c("26", "12", "10", "9", "7", "8", "13", "13", "1"),
                    NA2014 = c("26", "9", "11", "8", "8", "9", "13", "15", "2"),
                    NA2015 = c("28", "10", "10", "6", "9", "8", "14", "14", "1"),
                    NA2016 = c("27", "14", "9", "8", "7", "8", "14", "13", "2"),
                    NA2017 = c("32", "10", "8", "6", "7", "7", "14", "16", "1"),
                    NA2018 = c("32", "12", "8", "8", "6", "8", "13", "14", "1"),
                    NA2019 = c("35", "10", "7", "6", "7", "8", "14", "14", "1")
) %>% 
  as_tibble()

bible <- bible %>% 
  select(freq, NA2011, NA2015, NA2019)

bible <- melt(bible, id.vars = "freq")

bible <- bible %>% 
  mutate(year = gsub("NA", "", .$variable)) %>% 
  mutate(year = as.numeric(year)) %>% 
  mutate(pct = as.numeric(value)/100) %>% 
  select(freq, year, pct) %>% 
  as_tibble()


bible$freq <- factor(bible$freq, levels = c("Not sure", "Never", "Less than once a year", "Once or twice a year", "Three or four times a year", "Once a month", "Once a week", "Several times/4+ times a week", "Every day")) 



bible %>% 
  ggplot(., aes(x=1, y = pct, fill = fct_rev(freq))) +
  geom_col(color = "black") +
  coord_flip() +
  facet_wrap(~ year, ncol =1) +
  theme_gg("Abel") +
  theme(legend.position = "bottom") +
  scale_fill_d3() +
  scale_y_continuous(labels = percent) +
  guides(fill = guide_legend(reverse=T, nrow =2)) +
  theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) +
  theme(legend.text = element_text(size = 6)) +
  geom_text(aes(label = ifelse(pct >.05, paste0(pct*100, '%'), '')), position = position_stack(vjust = 0.5), size = 4, family = "font", color = "black") +
  theme(panel.grid.major.y = element_blank()) +
  theme(panel.grid.minor.y = element_blank()) +
  theme(plot.title = element_text(size = 16)) +
  labs(x = "", y = "", title = "Bible Reading", caption = "") 

Prayer