Description Usage Arguments Examples
This a Modification of case_when that keeps things in the order they were recoded
1 |
df |
Name of the Dataset |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | cces <- read_csv("https://raw.githubusercontent.com/ryanburge/cces/master/CCES%20for%20Methods/small_cces.csv")
cces %>%
mutate(pid_new = frcode(pid7 == 1 ~ "Strong Democrat",
pid7 == 2 ~ "Not Strong Democrat",
pid7 == 3 ~ "Lean Democrat",
pid7 == 4 ~ "Independent",
pid7 == 5 ~ "Lean Republican",
pid7 == 6 ~ "Not Strong Republican",
pid7 == 7 ~ "Strong Republican",
TRUE ~ "REMOVE")) %>%
ct(pid_new) %>%
filter(pid_new != "REMOVE") %>%
ggplot(., aes(x = pid_new, y = pct)) +
geom_col()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.