-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathGLOBAL_interpolation_addendum.R
More file actions
29 lines (22 loc) · 1.04 KB
/
GLOBAL_interpolation_addendum.R
File metadata and controls
29 lines (22 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
TRACTS.2019.SF <- map_dfr(STATES_TO_DOWNLOAD, .f = function(STATE){
tigris::tracts(STATE, cb = TRUE, year = 2019) %>%
filter(substr(GEOID, 1, 5) %in% COUNTIES_TO_DOWNLOAD)}) %>%
st_transform(TARGET_EPSG)
TRACTS.2019_IN_PLACE <- TRACTS.2019.SF %>%
st_filter(., st_buffer(PRIMARY_PLACE, dist = BUFFER_DISTANCE)) %>%
pull(GEOID)
tracts.2019_to_remove <- c('41005022208', '41051010200')
TRACTS.2019_IN_PLACE <- setdiff(TRACTS.2019_IN_PLACE, tracts.2019_to_remove)
TRACTS.2019.SF <- TRACTS.2019.SF %>%
mutate(in_primary_place = GEOID %in% TRACTS.2019_IN_PLACE) %>%
select(GEOID, in_primary_place)
# TRACTS.SF <- TRACTS.SF %>% select(GEOID, in_primary_place)
TRACTS_2010t2020.SF <- rbind(
mutate(TRACTS.2019.SF, year = 2010),
mutate(TRACTS.2019.SF, year = 2015),
TRACTS.SF %>% select(GEOID, in_primary_place) %>% mutate(year = 2020)
)
STATE_BLOCKS.2020 <- map_dfr(STATES_TO_DOWNLOAD, .f = function(STATE){
tigris::blocks(STATE, year = 2020) %>%
filter(substr(GEOID20, 1, 5) %in% COUNTIES_TO_DOWNLOAD)}) %>%
st_transform(TARGET_EPSG)