Skip to content

Instantly share code, notes, and snippets.

@ryanburge
Last active October 27, 2021 23:07
Show Gist options
  • Save ryanburge/162941522f65d47aaf85bc763e5fface to your computer and use it in GitHub Desktop.
Save ryanburge/162941522f65d47aaf85bc763e5fface to your computer and use it in GitHub Desktop.
October 20th Graduate Students
cces16 <- read_csv("https://raw.githubusercontent.com/ryanburge/cces/master/CCES%20for%20Methods/small_cces.csv")
cces20 <- read_csv("https://www.dropbox.com/s/wuixmc67ae786wp/small_ces2020.csv?dl=1")
Codebook for 2016
https://github.com/ryanburge/cces/raw/master/Codebooks/CCES_2016_Small_Codebook.pdf
Codebook for 2020
https://www.dropbox.com/s/s01kefaks4u6g1f/small_ces2020%20Codebook.docx?dl=0
gg %>%
ggplot(., aes(x = 1, y = pct, fill = fct_rev(pid3))) +
geom_col(color = "black") +
coord_flip() +
facet_grid(race2 ~ att3) +
theme(legend.position = "bottom") +
scale_y_continuous(labels = percent) +
theme(strip.text.y.left = element_text(angle=0)) +
guides(fill = guide_legend(reverse=T, nrow = 1)) +
theme(axis.title.y=element_blank(), axis.text.y=element_blank(), axis.ticks.y=element_blank()) +
theme(panel.grid.minor.y=element_blank(), panel.grid.major.y=element_blank()) +
geom_text(aes(label = ifelse(pct >.05, paste0(pct*100, '%'), '')), position = position_stack(vjust = 0.5), size = 4, color = "black")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment