library(tidyverse)
library(tidycensus)
library(scales)
library(viridis)
options(scipen = 999)
# load a list of all decennial census data from the Redistricting File
pl_vars_2020 <- load_variables(2020, "pl", cache = T)
# load a list of all acs variables
acs_vars_2020 <- load_variables(2020, "acs5", cache = T)
# Total Population - P1_001N
# Percent Hispanic or Latino - P2_002N/P1_001N
# Percent White alone, not Hispanic or Latino - P2_005N/P1_001N
# Percent Black alone, not Hispanic or Latino - P2_006N/P1_001N
# Percent Asian alone, not Hispanic or Latino - P2_008N/P1_001N
# import population by race for each county in Mississippi
raw_race_2020 = get_decennial(geography = "county",
variables=c("P1_001N", "P2_002N", "P2_005N", "P2_006N",
"P2_007N", "P2_008N", "P2_009N", "P2_010N"),
state='MS',
geometry = FALSE,
year = 2020)main_data folder
The main_data folder will store all of the census data that we process and any other data we might want to use again.
- Create a new R project in the
main_datafolder. - We’ll always work in this project when we process and explore data.