Skip to content

Instantly share code, notes, and snippets.

@walkerke
Created November 7, 2018 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walkerke/b8723fd2ae2eb4e134d696a800db12e9 to your computer and use it in GitHub Desktop.
Save walkerke/b8723fd2ae2eb4e134d696a800db12e9 to your computer and use it in GitHub Desktop.
library(tidycensus)
library(tidyverse)
library(sf)
racevars <- c(White = "P005003",
Black = "P005004",
Asian = "P005006",
Hispanic = "P004003")
race <- get_decennial(geography = "tract", variables = racevars,
state = "DC", county = "District of Columbia",
geometry = TRUE,
summary_var = "P001001") %>%
mutate(percent = 100 * (value / summary_value)) %>%
st_transform(26918)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment