This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(idbr) | |
library(tidyverse) | |
library(gganimate) | |
france_data <- get_idb( | |
country = "France", | |
year = 1990:2021, | |
age = 0:100, | |
sex = c("male", "female") | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, ~{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidycensus) | |
library(tidyverse) | |
library(sf) | |
racevars <- c(White = "P005003", | |
Black = "P005004", | |
Asian = "P005006", | |
Hispanic = "P004003") | |
race <- get_decennial(geography = "tract", variables = racevars, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidycensus) | |
library(tidyverse) | |
library(gganimate) | |
williams <- get_estimates(geography = "county", | |
product = "characteristics", | |
breakdown = c("AGEGROUP", "SEX"), | |
breakdown_labels = TRUE, | |
state = "ND", | |
county = "Williams", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidycensus) | |
library(mapdeck) | |
library(tidyverse) | |
token <- "your mapbox token" | |
hv <- get_acs(geography = "tract", | |
variables = "B25077_001", | |
state = "CA", | |
geometry = TRUE) %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidycensus) | |
library(tigris) | |
library(tidyverse) | |
library(sf) | |
library(extrafont) | |
options(tigris_use_cache = TRUE, tigris_class = "sf") | |
######################################################################## | |
######################################################################## | |
# Chart 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |