Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(tidyverse)
- library(googlesheets) # reading the data
- library(statebins) # mapping wrapper
- # load data by publig googlesheets key
- states <- gs_key("1Fb0YmrM7IX9wuQ047oQU6pNj1osWsz7sWKS4wgIFJGA")
- states_gs <- gs_read(ss = states, ws = 1)
- # recode values in preferred order
- st_raw <- states_gs %>%
- mutate(is_yes = recode(centralized,
- `yes` = 5,
- `no` = 3,
- `partial` = 4,
- `other` = 2,
- .default = 1))
- # plot with statebins, a wrapper to ggplot
- statebins(state_data = st_raw,
- value_col = "is_yes",
- labels = rev(c("Yes", "Partial", "No", NA, "No response")),
- legend_title = "State collect CVRs from counties?",
- brewer_pal = "Oranges") +
- labs(caption = "Responses as of 2019-07-11")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement