Skip to content

Instantly share code, notes, and snippets.

View walkerke's full-sized avatar

Kyle Walker walkerke

View GitHub Profile
library(tidycensus)
library(tigris)
library(tidyverse)
library(sf)
library(ggiraph)
library(patchwork)
options(tigris_use_cache = TRUE)
set.seed(123456)
# Get a list of counties within the Austin CBSA using tigris
library(mapboxapi)
library(mapview)
mb_access_token("YOUR TOKEN GOES HERE")
isos <- mb_isochrone("2500 Victory Ave, Dallas TX",
time = c(5, 10, 15),
profile = "driving-traffic")
mapview(isos, zcol = "time",
library(tidycensus)
library(tidyverse)
library(showtext)
font_add_google("Montserrat")
showtext_auto()
us_occ_pums <- get_pums(
variables = c("OCCP", "WAGP"),
state = "all",
survey = "acs1",
library(tidycensus)
library(tigris)
library(tidyverse)
library(sf)
options(tigris_use_cache = TRUE)
set.seed(123456)
austin_counties <- counties(year = 2021) %>%
filter(CBSAFP == "12420") %>%
pull(COUNTYFP)
library(tidycensus)
library(tidyverse)
options(tigris_use_cache = TRUE)
state_names <- c(state.name, "District of Columbia")
names(state_names) <- state_names
tictoc::tic()
age_maps <- map(state_names, ~{
library(tidyverse)
library(tidycensus)
library(showtext)
font_add_google("Montserrat")
showtext_auto()
continental <- read_csv("https://www.ncei.noaa.gov/access/monitoring/climate-at-a-glance/county/mapping/110-tavg-202402-1.csv", skip = 4) |>
mutate(avg_temp = as.numeric(Value),
GEOID = map_chr(ID, ~{
last3 <- str_sub(.x, start = -3)
# Requires tidycensus dev version
# remotes::install_github("walkerke/tidycensus")
library(tidyverse)
library(tidycensus)
library(showtext)
font_add_google("Montserrat")
showtext_auto()
pres_results <- read_csv("https://raw.githubusercontent.com/tonmcg/US_County_Level_Election_Results_08-20/master/2020_US_County_Level_Presidential_Results.csv")
library(sf)
library(tigris)
library(tidycensus)
library(tidyverse)
library(mapview)
library(mapboxapi)
library(randomNames)
options(tigris_use_cache = TRUE)
denton <- counties(cb = TRUE) %>%
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(tidyverse)
library(sf)
library(mapboxapi)
library(tigris)
library(fasterize)
library(leaflet)
# Get county boundaries; you can analyze for any county
target_GEOID <- "48309"