Skip to content

Instantly share code, notes, and snippets.

View walkerke's full-sized avatar

Kyle Walker walkerke

View GitHub Profile
library(tidycensus)
library(mapgl)
library(tidyverse)
library(sf)
options(tigris_use_cache = TRUE)
# Universe: adults (18+) born in the 50 states or DC. Excludes the
# foreign-born as well as natives born in Puerto Rico, the U.S. Island
# Areas, or abroad to U.S.-citizen parents, none of whom have a state
# of birth.
# -------------------------------------------------------------------------
# What do plumbers actually earn?
#
# Fact-check of the viral claim that plumbers are "clearing $250k-$300k/year",
# using the 2024 1-year American Community Survey Public Use Microdata Sample
# (PUMS), accessed with tidycensus.
#
# Universe: employed plumbers, pipefitters, and steamfitters (SOC 47-2152)
# in the United States. Estimates use the PUMS person weight (PWGTP).
# (For standard errors, add rep_weights = "person" to the get_pums() call
library(tidycensus)
library(mapgl)
library(tidyverse)
library(sf)
options(tigris_use_cache = TRUE)
adult_total_vars <- paste0("B06001_", sprintf("%03d", 4:12))
adult_born_vars <- paste0("B06001_", sprintf("%03d", 16:24))
puma_birth <- get_acs(
library(tidycensus)
library(mapgl)
library(tidyverse)
library(sf)
library(tigris)
options(tigris_use_cache = TRUE)
adult_total_vars <- paste0("B06001_", sprintf("%03d", 4:12))
adult_born_vars <- paste0("B06001_", sprintf("%03d", 16:24))
library(tigris)
library(mapgl)
library(freestiler)
library(tidyverse)
options(tigris_use_cache = TRUE)
ac_estimates <- read_csv(
"https://www2.census.gov/programs-surveys/demo/datasets/lace/2023/LACE_23_Tract.csv"
) |>
mutate(GEOID = str_sub(GEO_ID, start = -11))
library(mapgl) # Get the new features: pak::pak("walkerke/mapgl")
library(tidycensus)
library(sf)
library(tidyverse)
sf_use_s2(FALSE)
tx_bgs <- get_acs(
geography = "block group",
variables = "B01001_001",
state = "TX",
library(shiny)
library(mapgl)
library(tidycensus)
library(bslib)
options(tigris_use_cache = TRUE)
# Get LA income data
la_income <- get_acs(
geography = "tract",
variables = "B19013_001",
# Day 27: Boundaries - World Time Zones
# The invisible lines that govern our daily lives
# Uses current IANA time zone rules, including daylight saving time at render time.
library(mapgl)
library(sf)
library(dplyr)
library(lubridate)
tz_release <- "2026b"
# Day 26: Transport - US Electric Power Transmission Lines
# Visualizing America's invisible highway: 700,000+ miles of power lines
# Dynamic line widths by voltage class, glowing effect for the energy flow
library(mapgl)
library(sf)
library(dplyr)
# Load transmission lines from HIFLD (Homeland Infrastructure Foundation-Level Data)
# This is a large dataset - we'll use direct URL for the GeoJSON
# Day 25: Hexagons - US Wind Energy Infrastructure
# Multi-resolution H3 hexagonal aggregation of 72,000+ wind turbines
# Aggregating total installed capacity (MW) per hexagon
# Points fade in at high zoom for individual turbine exploration
library(mapgl)
library(h3o)
library(sf)
library(dplyr)
library(readr)