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) | |
dc_density <- get_acs( | |
geography = "tract", | |
state = "DC", | |
variables = "B01003_001", | |
geometry = TRUE, | |
keep_geo_vars = 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(shiny) | |
library(leaflet) | |
library(mapboxapi) | |
library(glue) | |
# If publishing to a Shiny server you'll need to be explicit about your token | |
# Swap in your token for your tileset | |
mapbox_token <- "pk.ey..." | |
# Define a simple UI; set the default cursor to pointer |
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(mapboxapi) | |
library(tidycensus) | |
library(tidyverse) | |
library(sf) | |
library(ggspatial) | |
options(tigris_use_cache = TRUE) | |
# Get the data from the ACS | |
tarrant <- get_acs( | |
geography = "tract", |
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(mapboxapi) | |
library(tidycensus) | |
library(tidyverse) | |
library(tmap) | |
library(ggspatial) | |
options(tigris_use_cache = TRUE) | |
# Get the data from the ACS | |
# | |
# Requires a Census API key: read https://walker-data.com/census-r/an-introduction-to-tidycensus.html#getting-started-with-tidycensus |
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) | |
library(mapview) | |
library(crsuggest) | |
# Get data on median home value by block group in Fort Bend County | |
fort_bend_value <- get_acs( | |
geography = "block group", | |
variables = "B25077_001", |
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) # Make sure you have tidycensus 1.1 or higher | |
library(redist) | |
library(sf) | |
library(tidyverse) | |
library(tigris) # Make sure you have tigris 1.5 or higher | |
library(httr) | |
options(tigris_use_cache = TRUE) | |
set.seed(123456) |
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(ggiraph) | |
library(tidyverse) | |
library(patchwork) | |
vt_income <- get_acs( | |
geography = "county", | |
variables = "B19013_001", | |
state = "VT", | |
year = 2019, |
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(tigris) | |
library(sf) | |
options(tigris_use_cache = TRUE) | |
us_states <- c(state.abb, "DC", "PR") | |
# To get the map to work correctly, | |
# empty geometries must be removed along with |
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(ggiraph) | |
library(tidyverse) | |
us_median_age <- get_acs( | |
geography = "state", | |
variables = "B01002_001", | |
year = 2019, | |
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(tigris) | |
library(sf) | |
# Get shapefile from UNL Drought Monitor | |
# https://droughtmonitor.unl.edu/data/shapefiles_m/USDM_20210427_M.zip | |
# Explode the shapes then shift geometry | |
drought <- st_read("USDM_20210427.shp") %>% | |
st_cast("POLYGON") %>% | |
shift_geometry() |