Skip to content

Instantly share code, notes, and snippets.

@abkosar
Created April 30, 2016 02:49
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 abkosar/216f06cdde50bdc527af818c7f2423bb to your computer and use it in GitHub Desktop.
Save abkosar/216f06cdde50bdc527af818c7f2423bb to your computer and use it in GitHub Desktop.
##########################TOTAL NUMBER OF DEATHS - BY ZIPCODES#####################
Zipcodes <- by_borough %>%
mutate(region = as.character(ZIP.CODE))
ZipcodesGrouped = group_by(Zipcodes, BOROUGH, ZIP.CODE)
ZipCodes <- select(ZipcodesGrouped, region, NUMBER.OF.PERSONS.KILLED) %>%
summarise(sum(NUMBER.OF.PERSONS.KILLED))
ZipCodes = ZipCodes[-1]
colnames(ZipCodes) = c("region", "value")
ZipCodes$region = clean.zipcodes(ZipCodes$region) ##integer to character
ZipCodes = ZipCodes[-which(is.na(ZipCodes$region)), ]
ZipCodes =ZipCodes[!duplicated(ZipCodes$region), ]
ZipCodes = ZipCodes[!ZipCodes$region %in% c("11249", "10000", "10048", "10281", "11695"), ]
Total_Death_by_Zipcodes <- zip_choropleth(ZipCodes, zip_zoom=ZipCodes$region, title = "Total Deaths by Zip Codes", legend = "Number of Total Deaths", num_colors = 5)
Total_Death_by_Zipcodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment