Skip to content

Instantly share code, notes, and snippets.

@ryanburge
Last active May 25, 2019 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanburge/1f3334b01432b58b6c40b2ee7b21ba04 to your computer and use it in GitHub Desktop.
Save ryanburge/1f3334b01432b58b6c40b2ee7b21ba04 to your computer and use it in GitHub Desktop.
VSG Blacks Deserve More or Less
graph <- tibble::tribble(
~bab, ~ba16f, ~mean, ~sd, ~n, ~level, ~se, ~lower, ~upper, ~year,
"No", "0", 1.997, 0.888342, 5586, 0.05, 0.011886, 1.974034, 2.020635, 2011,
"No", "1", 1.777, 0.935648, 328, 0.05, 0.051663, 1.675319, 1.878584, 2011,
"Yes", "0", 2.015, 0.969264, 234, 0.05, 0.063363, 1.890163, 2.139837, 2011,
"Yes", "1", 1.86, 0.890131, 1851, 0.05, 0.02069, 1.819295, 1.90045, 2011,
"No", "0", 2.273, 1.030418, 5586, 0.05, 0.013787, 2.246446, 2.300501, 2016,
"No", "1", 1.917, 1.012122, 328, 0.05, 0.055885, 1.806727, 2.026606, 2016,
"Yes", "0", 2.276, 1.071907, 234, 0.05, 0.070073, 2.137644, 2.413758, 2016,
"Yes", "1", 1.999, 0.999094, 1851, 0.05, 0.023222, 1.953852, 2.044941, 2016
)
graph <- graph %>%
mutate(ba11 = bab) %>%
mutate(ba16 = ba16f) %>%
mutate(ba16 = car::recode(ba16, "1= 'Yes'; 0 = 'No'")) %>%
mutate(status = paste(ba11, ba16, sep = "-")) %>%
mutate(status2 = car::recode(status, "'No-No' = 'Stayed Not BA'; 'Yes-Yes' = 'Stayed BA'; 'Yes-No' = 'Deconverted from BA'; 'No-Yes' = 'Converted to BA'"))
graph %>%
ggplot(., aes(y=mean, x= year)) +
geom_point(position=position_dodge(width=0.5), size =4) +
geom_errorbar(aes(ymin = lower, ymax=upper), position=position_dodge(0.5), size = 1) +
facet_wrap(~status2) +
coord_flip() +
scale_x_continuous(breaks = c(2011, 2016)) +
labs(y = "<---- Blacks Have Gotten More than They Deserve: Blacks Have Gotten Less than They Deserve -->", x = "Survey Years")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment