Skip to content

Instantly share code, notes, and snippets.

View walkerke's full-sized avatar

Kyle Walker walkerke

View GitHub Profile
library(tidycensus)
library(tidyverse)
dc_density <- get_acs(
geography = "tract",
state = "DC",
variables = "B01003_001",
geometry = TRUE,
keep_geo_vars = TRUE
) %>%
library(shiny)
library(leaflet)
library(mapboxapi)
library(glue)
# If publishing to a Shiny server you'll need to be explicit about your token
# Swap in your token for your tileset
mapbox_token <- "pk.ey..."
# Define a simple UI; set the default cursor to pointer
library(mapboxapi)
library(tidycensus)
library(tidyverse)
library(sf)
library(ggspatial)
options(tigris_use_cache = TRUE)
# Get the data from the ACS
tarrant <- get_acs(
geography = "tract",
library(mapboxapi)
library(tidycensus)
library(tidyverse)
library(tmap)
library(ggspatial)
options(tigris_use_cache = TRUE)
# Get the data from the ACS
#
# Requires a Census API key: read https://walker-data.com/census-r/an-introduction-to-tidycensus.html#getting-started-with-tidycensus
library(tidycensus)
library(tidyverse)
library(sf)
library(mapview)
library(crsuggest)
# Get data on median home value by block group in Fort Bend County
fort_bend_value <- get_acs(
geography = "block group",
variables = "B25077_001",
library(tidycensus) # Make sure you have tidycensus 1.1 or higher
library(redist)
library(sf)
library(tidyverse)
library(tigris) # Make sure you have tigris 1.5 or higher
library(httr)
options(tigris_use_cache = TRUE)
set.seed(123456)
library(tidycensus)
library(ggiraph)
library(tidyverse)
library(patchwork)
vt_income <- get_acs(
geography = "county",
variables = "B19013_001",
state = "VT",
year = 2019,
library(tidycensus)
library(tidyverse)
library(tigris)
library(sf)
options(tigris_use_cache = TRUE)
us_states <- c(state.abb, "DC", "PR")
# To get the map to work correctly,
# empty geometries must be removed along with
library(tidycensus)
library(tigris)
library(ggiraph)
library(tidyverse)
us_median_age <- get_acs(
geography = "state",
variables = "B01002_001",
year = 2019,
survey = "acs5",
library(tigris)
library(sf)
# Get shapefile from UNL Drought Monitor
# https://droughtmonitor.unl.edu/data/shapefiles_m/USDM_20210427_M.zip
# Explode the shapes then shift geometry
drought <- st_read("USDM_20210427.shp") %>%
st_cast("POLYGON") %>%
shift_geometry()