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)
states <- c(state.abb, "DC")
us_age_data <- map_df(states, ~{
get_pums(
variables = c("PUMA", "AGEP"),
state = .x,
survey = "acs5",
library(idbr)
library(tidyverse)
library(gganimate)
france_data <- get_idb(
country = "France",
year = 1990:2021,
age = 0:100,
sex = c("male", "female")
)
library(tidycensus)
library(mapdeck)
library(sf)
options(tigris_use_cache = TRUE)
tract_median_age <- get_acs(
geography = "tract",
variables = "B01002_001",
state = c(state.abb, "DC", "PR"),
geometry = TRUE
library(tigris)
library(tidyverse)
options(tigris_class = "sf")
# Get a vector of county codes
ia_counties <- counties("IA", cb = TRUE, resolution = "20m") %>%
pull(COUNTYFP)
# Iterate through the county codes and combine the result
ia_roads <- map(ia_counties, ~{
library(tidycensus)
library(tidyverse)
library(sf)
racevars <- c(White = "P005003",
Black = "P005004",
Asian = "P005006",
Hispanic = "P004003")
race <- get_decennial(geography = "tract", variables = racevars,
library(tidycensus)
library(tidyverse)
library(gganimate)
williams <- get_estimates(geography = "county",
product = "characteristics",
breakdown = c("AGEGROUP", "SEX"),
breakdown_labels = TRUE,
state = "ND",
county = "Williams",
library(tigris)
library(tidycensus)
library(tidyverse)
library(sf)
ma_income <- get_acs(geography = "county subdivision",
variables = "B19013_001",
state = "MA")
ma_subs <- county_subdivisions(state = "MA", cb = TRUE, class = "sf") %>%
library(tidycensus)
library(mapdeck)
library(tidyverse)
token <- "your mapbox token"
hv <- get_acs(geography = "tract",
variables = "B25077_001",
state = "CA",
geometry = TRUE) %>%
library(tidycensus)
library(tigris)
library(tidyverse)
library(sf)
library(extrafont)
options(tigris_use_cache = TRUE, tigris_class = "sf")
########################################################################
########################################################################
# Chart 1
library(rnaturalearth)
library(sf)
library(plotly)
library(crosstalk)
library(viridis)
ng <- ne_states(country = "Nigeria", returnclass = "sf") %>%
select(Name = name)
# Source: https://dhsprogram.com/pubs/pdf/FR293/FR293.pdf