Skip to content

Instantly share code, notes, and snippets.

@tslumley
Created May 23, 2021 02:25
Show Gist options
  • Save tslumley/0d135562e10e74bdd3110561c86aaa2c to your computer and use it in GitHub Desktop.
Save tslumley/0d135562e10e74bdd3110561c86aaa2c to your computer and use it in GitHub Desktop.
Compute proportion vaccinated for MA
library(dplyr)
library(rlang)
ma<-read.csv("~/Downloads/weekly-covid-19-municipality-vaccination-report-5-20-2021 (1)/Age - municipality-Table 1.csv",skip=1)
ma %>%
mutate(pop = as.numeric(gsub(",","",Population)), vax=as.numeric(gsub(",","",Fully.vaccinated.individuals))) -> ma_all
ma_all %>%
filter(Age.Group %in% c("65-74 Years","75+ Years")) %>%
select(County,Town,Age.Group,pop,vax) %>%
group_by(County,Town) %>%
summarise(pop_old=sum(pop,na.rm=TRUE),vax_old=sum(vax,na.rm=TRUE)) ->ma_old
ma_old %>%
summarise(n=sum(pop_old,na.rm=TRUE),v=sum(vax_old,na.rm=TRUE)) %>%
mutate(pct=100*v/n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment