Skip to content

Instantly share code, notes, and snippets.

@rudeboybert
Last active November 4, 2016 13:52
Show Gist options
  • Save rudeboybert/18c659ed74f91d6b49ec5fc6846da70f to your computer and use it in GitHub Desktop.
Save rudeboybert/18c659ed74f91d6b49ec5fc6846da70f to your computer and use it in GitHub Desktop.
library(dplyr)
library(ggplot2)
library(rgdal)
library(leaflet)
# Set your working directory to where the folder that contains your shapefiles is at:
VT <- rgdal::readOGR("VT_shapefiles/tl_2015_50_tract.shp", layer = "tl_2015_50_tract")
# The variable in ALAND exists here, i.e. you don't need to join anything
VT@data
leaflet(VT) %>%
addTiles() %>%
addPolylines(color="black", weight=1) %>%
addPolygons(
stroke = FALSE, fillOpacity = 0.5, smoothFactor = 0.5,
color = ~colorQuantile("YlOrRd", VT$ALAND)(ALAND)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment