<- BLACK_tract[BLACK_tract$year %in% c(2013, 2019),] %>% select(tract, year, estimate) %>% pivot_wider(names_from = year, values_from = estimate)
BLACK_tract_C
$Delta <- BLACK_tract_C$`2019` - BLACK_tract_C$`2013`
BLACK_tract_C
<- rbind(slice_min(BLACK_tract_C, order_by = abs(Delta), n= 1),
Change slice_max(BLACK_tract_C, order_by = (Delta), n= 1),
slice_min(BLACK_tract_C, order_by = (Delta), n= 1))
= c("Most Stable","Greatest Increase", "Greatest Decrease")
names
<- left_join(BLACK_tract, cbind(Change,names), "tract") BLACK_tract
San Antonio Promise Zones
= BLACK_tract
df
<-
Plot ggplot(data = df, aes(y = estimate, x = year, group = year)) + geom_boxplot(color = "azure4", fill = "linen") + geom_point(alpha = 0.3, color = "darkgrey") + geom_line(aes(group = tract), alpha = 0.09) +
geom_line(
data = subset(
df,%in% c("Greatest Increase", "Most Stable", "Greatest Decrease")
names
),aes(
group = tract,
color = paste0(names, " (Tract ", tract, ", ", round(Delta), "%", ")")
),size = 1.25
+
) scale_color_discrete(name = "") +
::theme_pubr() +
ggpubrylab("Percent of Population Non-Hispanic Black") +
xlab("Year") +
ggtitle(label = "Percent Change in Population Percent Non-Hispanic Black, 2013-2019", subtitle = "Census Tracts San Antonio Promise Zone") +
theme(
plot.title = element_text(
size = 12,
face = "bold",
family = "Sans", hjust = 0.5
axis.title.x = element_text(face = "bold", size = 9),
),axis.title.y = element_text(face = "bold", size =9),
legend.spacing.x = unit(0.2, 'cm'), plot.subtitle = element_text(hjust = 0.5),
legend.background = element_rect(color = "white", fill = "snow2"), legend.text = element_text(size = 7.5), legend.direction = "horizontal", legend.position = "top", plot.caption = element_text(size =8, color = "darkgrey"), plot.background = element_rect(color = "black", fill = NA)
+labs(caption= "Source: American Community Survey \n Authors: Julia Kay Wolf, Drew Schaefer, Jacob M. Souch") )
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
Plot
Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family
not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
<- get_acs(state = "TX",
nhblack19 county = "Bexar",
geography = "tract",
variables = "DP05_0078PE",
geometry = TRUE,
year = 2019)
Getting data from the 2015-2019 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using the ACS Data Profile
|
| | 0%
|
| | 1%
|
|= | 1%
|
|= | 2%
|
|== | 3%
|
|=== | 4%
|
|=== | 5%
|
|==== | 5%
|
|==== | 6%
|
|===== | 7%
|
|===== | 8%
|
|====== | 8%
|
|======= | 9%
|
|======= | 10%
|
|======== | 11%
|
|======== | 12%
|
|========= | 12%
|
|========= | 13%
|
|========= | 14%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 15%
|
|=========== | 16%
|
|============ | 17%
|
|============ | 18%
|
|============= | 18%
|
|============= | 19%
|
|============== | 20%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 23%
|
|================= | 24%
|
|================= | 25%
|
|================== | 25%
|
|================== | 26%
|
|=================== | 27%
|
|==================== | 28%
|
|==================== | 29%
|
|===================== | 30%
|
|====================== | 32%
|
|======================= | 33%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 36%
|
|========================== | 37%
|
|========================== | 38%
|
|=========================== | 38%
|
|=========================== | 39%
|
|============================ | 40%
|
|============================ | 41%
|
|============================= | 42%
|
|============================== | 42%
|
|============================== | 43%
|
|=============================== | 44%
|
|================================ | 45%
|
|================================ | 46%
|
|================================= | 47%
|
|================================== | 48%
|
|================================== | 49%
|
|=================================== | 50%
|
|==================================== | 51%
|
|==================================== | 52%
|
|===================================== | 52%
|
|===================================== | 54%
|
|====================================== | 54%
|
|======================================= | 55%
|
|======================================= | 56%
|
|======================================== | 57%
|
|======================================== | 58%
|
|========================================= | 58%
|
|========================================= | 59%
|
|========================================== | 60%
|
|=========================================== | 61%
|
|=========================================== | 62%
|
|============================================ | 63%
|
|============================================= | 64%
|
|============================================= | 65%
|
|============================================== | 65%
|
|============================================== | 66%
|
|=============================================== | 66%
|
|=============================================== | 67%
|
|=============================================== | 68%
|
|================================================ | 68%
|
|================================================ | 69%
|
|================================================= | 69%
|
|================================================= | 70%
|
|================================================== | 71%
|
|=================================================== | 72%
|
|=================================================== | 73%
|
|==================================================== | 74%
|
|===================================================== | 76%
|
|====================================================== | 77%
|
|======================================================= | 78%
|
|======================================================= | 79%
|
|======================================================== | 80%
|
|======================================================== | 81%
|
|========================================================= | 81%
|
|========================================================= | 82%
|
|========================================================== | 82%
|
|========================================================== | 83%
|
|=========================================================== | 84%
|
|=========================================================== | 85%
|
|============================================================ | 85%
|
|============================================================ | 86%
|
|============================================================= | 87%
|
|============================================================= | 88%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|=============================================================== | 90%
|
|================================================================ | 91%
|
|================================================================ | 92%
|
|================================================================= | 92%
|
|================================================================= | 93%
|
|================================================================== | 94%
|
|================================================================== | 95%
|
|=================================================================== | 96%
|
|==================================================================== | 97%
|
|===================================================================== | 98%
|
|===================================================================== | 99%
|
|======================================================================| 99%
|
|======================================================================| 100%
<- get_acs(state = "TX",
nhblack13 county = "Bexar",
geography = "tract",
variables = "DP05_0073PE",
geometry = TRUE,
year = 2013)
Getting data from the 2009-2013 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using the ACS Data Profile
|
| | 0%
|
|= | 1%
|
|= | 2%
|
|== | 2%
|
|== | 3%
|
|== | 4%
|
|=== | 5%
|
|==== | 5%
|
|==== | 6%
|
|===== | 6%
|
|===== | 7%
|
|===== | 8%
|
|====== | 8%
|
|====== | 9%
|
|======= | 10%
|
|======== | 11%
|
|======== | 12%
|
|========= | 13%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 16%
|
|============ | 17%
|
|============ | 18%
|
|============= | 18%
|
|============== | 20%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 22%
|
|================ | 23%
|
|================= | 24%
|
|================= | 25%
|
|================== | 25%
|
|================== | 26%
|
|=================== | 26%
|
|=================== | 27%
|
|==================== | 28%
|
|==================== | 29%
|
|===================== | 30%
|
|====================== | 31%
|
|====================== | 32%
|
|======================= | 33%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 36%
|
|========================== | 38%
|
|=========================== | 39%
|
|============================ | 40%
|
|============================= | 41%
|
|============================= | 42%
|
|============================== | 43%
|
|============================== | 44%
|
|=============================== | 45%
|
|================================ | 45%
|
|================================ | 46%
|
|================================= | 47%
|
|================================== | 48%
|
|================================== | 49%
|
|=================================== | 50%
|
|=================================== | 51%
|
|==================================== | 52%
|
|===================================== | 53%
|
|====================================== | 54%
|
|====================================== | 55%
|
|======================================= | 56%
|
|======================================== | 57%
|
|========================================= | 59%
|
|========================================== | 60%
|
|=========================================== | 61%
|
|=========================================== | 62%
|
|============================================ | 63%
|
|============================================= | 64%
|
|============================================= | 65%
|
|============================================== | 66%
|
|=============================================== | 68%
|
|================================================ | 68%
|
|================================================ | 69%
|
|================================================= | 70%
|
|================================================== | 71%
|
|================================================== | 72%
|
|=================================================== | 72%
|
|=================================================== | 73%
|
|==================================================== | 74%
|
|==================================================== | 75%
|
|===================================================== | 75%
|
|===================================================== | 76%
|
|====================================================== | 77%
|
|======================================================= | 78%
|
|======================================================= | 79%
|
|======================================================== | 79%
|
|======================================================== | 80%
|
|========================================================= | 81%
|
|========================================================== | 82%
|
|========================================================== | 83%
|
|========================================================== | 84%
|
|=========================================================== | 84%
|
|=========================================================== | 85%
|
|============================================================ | 86%
|
|============================================================= | 87%
|
|============================================================= | 88%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|=============================================================== | 90%
|
|================================================================ | 91%
|
|================================================================ | 92%
|
|================================================================= | 92%
|
|================================================================= | 93%
|
|================================================================== | 94%
|
|=================================================================== | 95%
|
|=================================================================== | 96%
|
|==================================================================== | 97%
|
|==================================================================== | 98%
|
|===================================================================== | 98%
|
|===================================================================== | 99%
|
|======================================================================| 100%
$tract <- word(nhblack19$NAME,3, sep= " ")
nhblack19$tract <- str_remove(nhblack19$tract, ",")
nhblack19<- nhblack19 %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
nhblack19 $tract <- word(nhblack13$NAME,3, sep= " ")
nhblack13$tract <- str_remove(nhblack13$tract, ",")
nhblack13<- nhblack13 %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
nhblack13 $black13 <- nhblack13$estimate
nhblack13$black19 <- nhblack19$estimate
nhblack19
st_geometry(nhblack19) <- NULL
<- left_join(nhblack13, nhblack19, by=c("GEOID"="GEOID"))
nhblackmap $`Percent Change` <- (nhblackmap$black13-nhblackmap$black19)
nhblackmap
<- tm_shape(nhblackmap, unit = "mi") +tm_basemap(server = "OpenStreetMap") + tm_polygons(c("Percent Change"), border.alpha = 0.2,
p palette="RdYlGn", style = "pretty") + tm_text('tract.y', size = 0.55) + tm_layout(title = "Percent Change Non-Hispanic Black, 2013-2019", title.size = 1,title.fontface = "bold",bg.color = "white" ,legend.bg.color = "snow2",legend.just = "left",inner.margins = 0.09 , legend.frame = FALSE) + tm_compass(position = "left")+ tm_scale_bar(position = "left")
p
Variable(s) "Percent Change" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
for (i in 2013:2016){
assign(x = paste0("WHITE",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP05_0072PE", year = i))
}
Getting data from the 2009-2013 5-year ACS
Using the ACS Data Profile
Getting data from the 2010-2014 5-year ACS
Using the ACS Data Profile
Getting data from the 2011-2015 5-year ACS
Using the ACS Data Profile
Getting data from the 2012-2016 5-year ACS
Using the ACS Data Profile
for (i in 2017:2019){
assign(x = paste0("WHITE",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP05_0077PE", year = i))
}
Getting data from the 2013-2017 5-year ACS
Using the ACS Data Profile
Getting data from the 2014-2018 5-year ACS
Using the ACS Data Profile
Getting data from the 2015-2019 5-year ACS
Using the ACS Data Profile
$year <- 2013
WHITE2013$year <- 2014
WHITE2014$year <- 2015
WHITE2015$year <- 2016
WHITE2016$year <- 2017
WHITE2017$year <- 2018
WHITE2018$year <- 2019
WHITE2019
<- list(WHITE2013, WHITE2014, WHITE2015,WHITE2016, WHITE2017, WHITE2018, WHITE2019)
WHITE
<- rbind(WHITE2013, WHITE2014, WHITE2015,WHITE2016, WHITE2017, WHITE2018, WHITE2019)
data_WHITE
rm(WHITE2013, WHITE2014, WHITE2015,WHITE2016, WHITE2017, WHITE2018, WHITE2019)
$tract <- word(data_WHITE$NAME,3, sep= " ")
data_WHITE$tract <- str_remove(data_WHITE$tract, ",")
data_WHITE
<- data_WHITE %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
WHITE_tract
<- WHITE_tract[WHITE_tract$year %in% c(2013, 2019),] %>% select(tract, year, estimate) %>% pivot_wider(names_from = year, values_from = estimate)
WHITE_tract_C
$Delta <- WHITE_tract_C$`2019` - WHITE_tract_C$`2013`
WHITE_tract_C
<- rbind(slice_min(WHITE_tract_C, order_by = abs(Delta), n= 1),
Change slice_max(WHITE_tract_C, order_by = (Delta), n= 1),
slice_min(WHITE_tract_C, order_by = (Delta), n= 1))
= c("Most Stable","Greatest Increase", "Greatest Decrease")
names
<- left_join(WHITE_tract, cbind(Change,names), "tract")
WHITE_tract
= WHITE_tract
df
<-
Plot ggplot(data = df, aes(y = estimate, x = year, group = year)) + geom_boxplot(color = "azure4", fill = "linen") + geom_point(alpha = 0.3, color = "darkgrey") + geom_line(aes(group = tract), alpha = 0.09) +
geom_line(
data = subset(
df,%in% c("Greatest Increase", "Most Stable", "Greatest Decrease")
names
),aes(
group = tract,
color = paste0(names, " (Tract ", tract, ", ", round(Delta), "%", ")")
),size = 1.25
+
) scale_color_discrete(name = "") +
::theme_pubr() +
ggpubrylab("Percent of Population Non-Hispanic White") +
xlab("Year") +
ggtitle(label = "Percent Change in Population Percent Non-Hispanic White, 2013-2019", subtitle = "Census Tracts San Antonio Promise Zone") +
theme(
plot.title = element_text(
size = 12,
face = "bold",
family = "Sans", hjust = 0.5
axis.title.x = element_text(face = "bold", size = 9),
),axis.title.y = element_text(face = "bold", size =9),
legend.spacing.x = unit(0.2, 'cm'), plot.subtitle = element_text(hjust = 0.5),
legend.background = element_rect(color = "white", fill = "snow2"), legend.text = element_text(size = 7.5), legend.direction = "horizontal", legend.position = "top", plot.caption = element_text(size =8, color = "darkgrey"), plot.background = element_rect(color = "black", fill = NA)
+labs(caption= "Source: American Community Survey \n Authors: Julia Kay Wolf, Drew Schaefer, Jacob M. Souch")
)
Plot
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
for (i in 2013:2016){
assign(x = paste0("HISPANIC",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP05_0066PE", year = i))
}
Getting data from the 2009-2013 5-year ACS
Using the ACS Data Profile
Getting data from the 2010-2014 5-year ACS
Using the ACS Data Profile
Getting data from the 2011-2015 5-year ACS
Using the ACS Data Profile
Getting data from the 2012-2016 5-year ACS
Using the ACS Data Profile
for (i in 2017:2019){
assign(x = paste0("HISPANIC",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP05_0071PE", year = i))
}
Getting data from the 2013-2017 5-year ACS
Using the ACS Data Profile
Getting data from the 2014-2018 5-year ACS
Using the ACS Data Profile
Getting data from the 2015-2019 5-year ACS
Using the ACS Data Profile
$year <- 2013
HISPANIC2013$year <- 2014
HISPANIC2014$year <- 2015
HISPANIC2015$year <- 2016
HISPANIC2016$year <- 2017
HISPANIC2017$year <- 2018
HISPANIC2018$year <- 2019
HISPANIC2019
<- list(HISPANIC2013, HISPANIC2014, HISPANIC2015,HISPANIC2016, HISPANIC2017, HISPANIC2018, HISPANIC2019)
HISPANIC
<- rbind(HISPANIC2013, HISPANIC2014, HISPANIC2015,HISPANIC2016, HISPANIC2017, HISPANIC2018, HISPANIC2019)
data_HISPANIC
rm(HISPANIC2013, HISPANIC2014, HISPANIC2015,HISPANIC2016, HISPANIC2017, HISPANIC2018, HISPANIC2019)
$tract <- word(data_HISPANIC$NAME,3, sep= " ")
data_HISPANIC$tract <- str_remove(data_HISPANIC$tract, ",")
data_HISPANIC
<- data_HISPANIC %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
HISPANIC_tract
<- HISPANIC_tract[HISPANIC_tract$year %in% c(2013, 2019),] %>% select(tract, year, estimate) %>% pivot_wider(names_from = year, values_from = estimate)
HISPANIC_tract_C
$Delta <- HISPANIC_tract_C$`2019` - HISPANIC_tract_C$`2013`
HISPANIC_tract_C
<- rbind(slice_min(HISPANIC_tract_C, order_by = abs(Delta), n= 1),
Change slice_max(HISPANIC_tract_C, order_by = (Delta), n= 1),
slice_min(HISPANIC_tract_C, order_by = (Delta), n= 1))
= c("Most Stable","Greatest Increase", "Greatest Decrease")
names
<- left_join(HISPANIC_tract, cbind(Change,names), "tract")
HISPANIC_tract
= HISPANIC_tract
df
<-
Plot ggplot(data = df, aes(y = estimate, x = year, group = year)) + geom_boxplot(color = "azure4", fill = "linen") + geom_point(alpha = 0.3, color = "darkgrey") + geom_line(aes(group = tract), alpha = 0.09) +
geom_line(
data = subset(
df,%in% c("Greatest Increase", "Most Stable", "Greatest Decrease")
names
),aes(
group = tract,
color = paste0(names, " (Tract ", tract, ", ", round(Delta), "%", ")")
),size = 1.25
+
) scale_color_discrete(name = "") +
::theme_pubr() +
ggpubrylab("Percent of Population Hispanic") +
xlab("Year") +
ggtitle(label = "Percent Change in Population Percent Hispanic, 2013-2019", subtitle = "Census Tracts San Antonio Promise Zone") +
theme(
plot.title = element_text(
size = 12,
face = "bold",
family = "Sans", hjust = 0.5
axis.title.x = element_text(face = "bold", size = 9),
),axis.title.y = element_text(face = "bold", size =9),
legend.spacing.x = unit(0.2, 'cm'), plot.subtitle = element_text(hjust = 0.5),
legend.background = element_rect(color = "white", fill = "snow2"), legend.text = element_text(size = 7.5), legend.direction = "horizontal", legend.position = "top", plot.caption = element_text(size =8, color = "darkgrey"), plot.background = element_rect(color = "black", fill = NA)
+labs(caption= "Source: American Community Survey \n Authors: Julia Kay Wolf, Drew Schaefer, Jacob M. Souch")
)
Plot
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
<- get_acs(state = "TX",
hispanic19 county = "Bexar",
geography = "tract",
variables = "DP05_0071PE",
geometry = TRUE,
year = 2019)
Getting data from the 2015-2019 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using the ACS Data Profile
<- get_acs(state = "TX",
hispanic13 county = "Bexar",
geography = "tract",
variables = "DP05_0066PE",
geometry = TRUE,
year = 2013)
Getting data from the 2009-2013 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using the ACS Data Profile
$tract <- word(hispanic19$NAME,3, sep= " ")
hispanic19$tract <- str_remove(hispanic19$tract, ",")
hispanic19<- hispanic19 %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
hispanic19 $tract <- word(hispanic13$NAME,3, sep= " ")
hispanic13$tract <- str_remove(hispanic13$tract, ",")
hispanic13<- hispanic13 %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
hispanic13 $hispanic13 <- hispanic13$estimate
hispanic13$hispanic19 <- hispanic19$estimate
hispanic19
st_geometry(hispanic19) <- NULL
<- left_join(hispanic13, hispanic19, by=c("GEOID"="GEOID"))
hispanicmap $`Percent Change` <- (hispanicmap$hispanic13-hispanicmap$hispanic19)
hispanicmap
<- tm_shape(hispanicmap, unit = "mi") +tm_basemap(server = "OpenStreetMap") + tm_polygons(c("Percent Change"), border.alpha = 0.2,
p palette="RdYlGn", style = "pretty") + tm_text('tract.y', size = 0.55) + tm_layout(title = "Percent Change Hispanic, 2013-2019", title.size = 1,title.fontface = "bold",bg.color = "white" ,legend.bg.color = "snow2",legend.just = "left",inner.margins = 0.09 , legend.frame = FALSE) + tm_compass(position = "left")+ tm_scale_bar(position = "left")
p
Variable(s) "Percent Change" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
for (i in 2013:2018){
assign(x = paste0("HSORMORE",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP02_0066PE", year = i))
}
Getting data from the 2009-2013 5-year ACS
Using the ACS Data Profile
Getting data from the 2010-2014 5-year ACS
Using the ACS Data Profile
Getting data from the 2011-2015 5-year ACS
Using the ACS Data Profile
Getting data from the 2012-2016 5-year ACS
Using the ACS Data Profile
Getting data from the 2013-2017 5-year ACS
Using the ACS Data Profile
Getting data from the 2014-2018 5-year ACS
Using the ACS Data Profile
for (i in 2019:2019){
assign(x = paste0("HSORMORE",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP02_0067P", year = i))
}
Getting data from the 2015-2019 5-year ACS
Using the ACS Data Profile
$year <- 2013
HSORMORE2013$year <- 2014
HSORMORE2014$year <- 2015
HSORMORE2015$year <- 2016
HSORMORE2016$year <- 2017
HSORMORE2017$year <- 2018
HSORMORE2018$year <- 2019
HSORMORE2019
<- list(HSORMORE2013, HSORMORE2014, HSORMORE2015,HSORMORE2016, HSORMORE2017, HSORMORE2018, HSORMORE2019)
HSORMORE
<- rbind(HSORMORE2013, HSORMORE2014, HSORMORE2015,HSORMORE2016, HSORMORE2017, HSORMORE2018, HSORMORE2019)
data_HSORMORE
rm(HSORMORE2013, HSORMORE2014, HSORMORE2015,HSORMORE2016, HSORMORE2017, HSORMORE2018, HSORMORE2019)
$tract <- word(data_HSORMORE$NAME,3, sep= " ")
data_HSORMORE$tract <- str_remove(data_HSORMORE$tract, ",")
data_HSORMORE
<- data_HSORMORE %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
HSORMORE_tract
<- HSORMORE_tract[HSORMORE_tract$year %in% c(2013, 2019),] %>% select(tract, year, estimate) %>% pivot_wider(names_from = year, values_from = estimate)
HSORMORE_tract_C
$Delta <- HSORMORE_tract_C$`2019` - HSORMORE_tract_C$`2013`
HSORMORE_tract_C
<- rbind(slice_min(HSORMORE_tract_C, order_by = abs(Delta), n= 1),
Change slice_max(HSORMORE_tract_C, order_by = (Delta), n= 1),
slice_min(HSORMORE_tract_C, order_by = (Delta), n= 1))
= c("Most Stable","Greatest Increase", "Greatest Decrease")
names
<- left_join(HSORMORE_tract, cbind(Change,names), "tract")
HSORMORE_tract
= HSORMORE_tract
df
<-
Plot ggplot(data = df, aes(y = estimate, x = year, group = year)) + geom_boxplot(color = "azure4", fill = "linen") + geom_point(alpha = 0.3, color = "darkgrey") + geom_line(aes(group = tract), alpha = 0.09) +
geom_line(
data = subset(
df,%in% c("Greatest Increase", "Most Stable", "Greatest Decrease")
names
),aes(
group = tract,
color = paste0(names, " (Tract ", tract, ", ", round(Delta), "%", ")")
),size = 1.25
+
) scale_color_discrete(name = "") +
::theme_pubr() +
ggpubrylab("Percent of Population High School or More") +
xlab("Year") +
ggtitle(label = "Percent Change in Population Percent High School Education or More, 2013-2019", subtitle = "Census Tracts San Antonio Promise Zone") +
theme(
plot.title = element_text(
size = 12,
face = "bold",
family = "Sans", hjust = 0.5
axis.title.x = element_text(face = "bold", size = 9),
),axis.title.y = element_text(face = "bold", size =9),
legend.spacing.x = unit(0.2, 'cm'), plot.subtitle = element_text(hjust = 0.5),
legend.background = element_rect(color = "white", fill = "snow2"), legend.text = element_text(size = 7.5), legend.direction = "horizontal", legend.position = "top", plot.caption = element_text(size =8, color = "darkgrey"), plot.background = element_rect(color = "black", fill = NA)
+labs(caption= "Source: American Community Survey \n Authors: Julia Kay Wolf, Drew Schaefer, Jacob M. Souch")
)
Plot
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
<- get_acs(state = "TX",
hs19 county = "Bexar",
geography = "tract",
variables = "DP02_0067P",
geometry = TRUE,
year = 2019)
Getting data from the 2015-2019 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using the ACS Data Profile
<- get_acs(state = "TX",
hs13 county = "Bexar",
geography = "tract",
variables = "DP02_0066PE",
geometry = TRUE,
year = 2013)
Getting data from the 2009-2013 5-year ACS
Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
Using the ACS Data Profile
$tract <- word(hs19$NAME,3, sep= " ")
hs19$tract <- str_remove(hs19$tract, ",")
hs19<- hs19 %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
hs19 $tract <- word(hs13$NAME,3, sep= " ")
hs13$tract <- str_remove(hs13$tract, ",")
hs13<- hs13 %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
hs13 $hs13 <- hs13$estimate
hs13$hs19 <- hs19$estimate
hs19
st_geometry(hs19) <- NULL
<- left_join(hs13, hs19, by=c("GEOID"="GEOID"))
hsmap $`Percent Change` <- (hsmap$hs13-hsmap$hs19)
hsmap
<- tm_shape(hsmap, unit = "mi") +tm_basemap(server = "OpenStreetMap") + tm_polygons(c("Percent Change"), border.alpha = 0.2,
p palette="RdYlGn", style = "pretty") + tm_text('tract.y', size = 0.55) + tm_layout(title = "Percent Change High School or Higher, 2013-2019", title.size = 1,title.fontface = "bold",bg.color = "white" ,legend.bg.color = "snow2",legend.just = "left",inner.margins = 0.09 , legend.frame = FALSE) + tm_compass(position = "left")+ tm_scale_bar(position = "left")
p
Variable(s) "Percent Change" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
for (i in 2013:2018){
assign(x = paste0("COLLORMORE",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP02_0067PE", year = i))
}
Getting data from the 2009-2013 5-year ACS
Using the ACS Data Profile
Getting data from the 2010-2014 5-year ACS
Using the ACS Data Profile
Getting data from the 2011-2015 5-year ACS
Using the ACS Data Profile
Getting data from the 2012-2016 5-year ACS
Using the ACS Data Profile
Getting data from the 2013-2017 5-year ACS
Using the ACS Data Profile
Getting data from the 2014-2018 5-year ACS
Using the ACS Data Profile
for (i in 2019:2019){
assign(x = paste0("COLLORMORE",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP02_0068PE", year = i))
}
Getting data from the 2015-2019 5-year ACS
Using the ACS Data Profile
$year <- 2013
COLLORMORE2013$year <- 2014
COLLORMORE2014$year <- 2015
COLLORMORE2015$year <- 2016
COLLORMORE2016$year <- 2017
COLLORMORE2017$year <- 2018
COLLORMORE2018$year <- 2019
COLLORMORE2019
<- list(COLLORMORE2013, COLLORMORE2014, COLLORMORE2015,COLLORMORE2016, COLLORMORE2017, COLLORMORE2018, COLLORMORE2019)
COLLORMORE
<- rbind(COLLORMORE2013, COLLORMORE2014, COLLORMORE2015,COLLORMORE2016, COLLORMORE2017, COLLORMORE2018, COLLORMORE2019)
data_COLLORMORE
rm(COLLORMORE2013, COLLORMORE2014, COLLORMORE2015,COLLORMORE2016, COLLORMORE2017, COLLORMORE2018, COLLORMORE2019)
$tract <- word(data_COLLORMORE$NAME,3, sep= " ")
data_COLLORMORE$tract <- str_remove(data_COLLORMORE$tract, ",")
data_COLLORMORE
<- data_COLLORMORE %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
COLLORMORE_tract
<- COLLORMORE_tract[COLLORMORE_tract$year %in% c(2013, 2019),] %>% select(tract, year, estimate) %>% pivot_wider(names_from = year, values_from = estimate)
COLLORMORE_tract_C
$Delta <- COLLORMORE_tract_C$`2019` - COLLORMORE_tract_C$`2013`
COLLORMORE_tract_C
<- rbind(slice_min(COLLORMORE_tract_C, order_by = abs(Delta), n= 1),
Change slice_max(COLLORMORE_tract_C, order_by = (Delta), n= 1),
slice_min(COLLORMORE_tract_C, order_by = (Delta), n= 1))
= c("Most Stable","Greatest Increase", "Greatest Decrease")
names
<- left_join(COLLORMORE_tract, cbind(Change,names), "tract")
COLLORMORE_tract
= COLLORMORE_tract
df
<-
Plot ggplot(data = df, aes(y = estimate, x = year, group = year)) + geom_boxplot(color = "azure4", fill = "linen") + geom_point(alpha = 0.3, color = "darkgrey") + geom_line(aes(group = tract), alpha = 0.09) +
geom_line(
data = subset(
df,%in% c("Greatest Increase", "Most Stable", "Greatest Decrease")
names
),aes(
group = tract,
color = paste0(names, " (Tract ", tract, ", ", round(Delta), "%", ")")
),size = 1.25
+
) scale_color_discrete(name = "") +
::theme_pubr() +
ggpubrylab("Percent of Population College or More") +
xlab("Year") +
ggtitle(label = "Percent Change in Population Percent College Education or More, 2013-2019", subtitle = "Census Tracts San Antonio Promise Zone") +
theme(
plot.title = element_text(
size = 12,
face = "bold",
family = "Sans", hjust = 0.5
axis.title.x = element_text(face = "bold", size = 9),
),axis.title.y = element_text(face = "bold", size =9),
legend.spacing.x = unit(0.2, 'cm'), plot.subtitle = element_text(hjust = 0.5),
legend.background = element_rect(color = "white", fill = "snow2"), legend.text = element_text(size = 7.5), legend.direction = "horizontal", legend.position = "top", plot.caption = element_text(size =8, color = "darkgrey"), plot.background = element_rect(color = "black", fill = NA)
+labs(caption= "Source: American Community Survey \n Authors: Julia Kay Wolf, Drew Schaefer, Jacob M. Souch")
)
Plot
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
for (i in 2013:2019){
assign(x = paste0("POVERTY",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP03_0119P", year = i))
}
Getting data from the 2009-2013 5-year ACS
Using the ACS Data Profile
Getting data from the 2010-2014 5-year ACS
Using the ACS Data Profile
Getting data from the 2011-2015 5-year ACS
Using the ACS Data Profile
Getting data from the 2012-2016 5-year ACS
Using the ACS Data Profile
Getting data from the 2013-2017 5-year ACS
Using the ACS Data Profile
Getting data from the 2014-2018 5-year ACS
Using the ACS Data Profile
Getting data from the 2015-2019 5-year ACS
Using the ACS Data Profile
$year <- 2013
POVERTY2013$year <- 2014
POVERTY2014$year <- 2015
POVERTY2015$year <- 2016
POVERTY2016$year <- 2017
POVERTY2017$year <- 2018
POVERTY2018$year <- 2019
POVERTY2019
<- rbind(POVERTY2013, POVERTY2014, POVERTY2015,POVERTY2016, POVERTY2017, POVERTY2018, POVERTY2019)
data_pov
<- list(POVERTY2013, POVERTY2014, POVERTY2015,POVERTY2016, POVERTY2017, POVERTY2018, POVERTY2019)
Poverty
rm(POVERTY2013, POVERTY2014, POVERTY2015,POVERTY2016, POVERTY2017, POVERTY2018, POVERTY2019)
$tract <- word(data_pov$NAME,3, sep= " ")
data_pov$tract <- str_remove(data_pov$tract, ",")
data_pov
<- data_pov %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
POVERTY_tract
<- POVERTY_tract[POVERTY_tract$year %in% c(2013, 2019),] %>% select(tract, year, estimate) %>% pivot_wider(names_from = year, values_from = estimate)
POVERTY_tract_C
$Delta <- POVERTY_tract_C$`2019` - POVERTY_tract_C$`2013`
POVERTY_tract_C
<- rbind(slice_min(POVERTY_tract_C, order_by = abs(Delta), n= 1),
Change slice_max(POVERTY_tract_C, order_by = (Delta), n= 1),
slice_min(POVERTY_tract_C, order_by = (Delta), n= 1))
= c("Most Stable","Greatest Increase", "Greatest Decrease")
names
<- left_join(POVERTY_tract, cbind(Change,names), "tract")
POVERTY_tract
= POVERTY_tract
df
<-
Plot ggplot(data = df, aes(y = estimate, x = year, group = year)) + geom_boxplot(color = "azure4", fill = "linen") + geom_point(alpha = 0.3, color = "darkgrey") + geom_line(aes(group = tract), alpha = 0.09) +
geom_line(
data = subset(
df,%in% c("Greatest Increase", "Most Stable", "Greatest Decrease")
names
),aes(
group = tract,
color = paste0(names, " (Tract ", tract, ", ", round(Delta), "%", ")")
),size = 1.25
+
) scale_color_discrete(name = "") +
::theme_pubr() +
ggpubrylab("Percent of Population in Poverty") +
xlab("Year") +
ggtitle(label = "Percent Change in Population Percent Poverty, 2013-2019", subtitle = "Census Tracts San Antonio Promise Zone") +
theme(
plot.title = element_text(
size = 12,
face = "bold",
family = "Sans", hjust = 0.5
axis.title.x = element_text(face = "bold", size = 9),
),axis.title.y = element_text(face = "bold", size =9),
legend.spacing.x = unit(0.2, 'cm'), plot.subtitle = element_text(hjust = 0.5),
legend.background = element_rect(color = "white", fill = "snow2"), legend.text = element_text(size = 7.5), legend.direction = "horizontal", legend.position = "top", plot.caption = element_text(size =8, color = "darkgrey"), plot.background = element_rect(color = "black", fill = NA)
+labs(caption= "Source: American Community Survey \n Authors: Julia Kay Wolf, Drew Schaefer, Jacob M. Souch")
)
Plot
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
for (i in 2013:2019){
assign(x = paste0("EMPLOY",i),get_acs(state = "TX", county = "Bexar",geography = "tract", variables = "DP03_0005PE", year = i))
}
Getting data from the 2009-2013 5-year ACS
Using the ACS Data Profile
Getting data from the 2010-2014 5-year ACS
Using the ACS Data Profile
Getting data from the 2011-2015 5-year ACS
Using the ACS Data Profile
Getting data from the 2012-2016 5-year ACS
Using the ACS Data Profile
Getting data from the 2013-2017 5-year ACS
Using the ACS Data Profile
Getting data from the 2014-2018 5-year ACS
Using the ACS Data Profile
Getting data from the 2015-2019 5-year ACS
Using the ACS Data Profile
$year <- 2013
EMPLOY2013$year <- 2014
EMPLOY2014$year <- 2015
EMPLOY2015$year <- 2016
EMPLOY2016$year <- 2017
EMPLOY2017$year <- 2018
EMPLOY2018$year <- 2019
EMPLOY2019
<- list(EMPLOY2013, EMPLOY2014, EMPLOY2015,EMPLOY2016, EMPLOY2017, EMPLOY2018, EMPLOY2019)
EMPLOY
<- rbind(EMPLOY2013, EMPLOY2014, EMPLOY2015,EMPLOY2016, EMPLOY2017, EMPLOY2018, EMPLOY2019)
data_emp
rm(EMPLOY2013, EMPLOY2014, EMPLOY2015,EMPLOY2016, EMPLOY2017, EMPLOY2018, EMPLOY2019)
$tract <- word(data_emp$NAME,3, sep= " ")
data_emp$tract <- str_remove(data_emp$tract, ",")
data_emp
<- data_emp %>% filter( tract %in% c( "1110", "1214.04", "1302", "1303", "1304.01", "1304.02", "1305", "1306", "1307", "1308", "1309", "1310", "1311", "1312", "1313", "1401", "1404", "1405", "1919"))
EMPLOYMENT_tract
<- EMPLOYMENT_tract[EMPLOYMENT_tract$year %in% c(2013, 2019),] %>% select(tract, year, estimate) %>% pivot_wider(names_from = year, values_from = estimate)
EMPLOYMENT_tract_C
$Delta <- EMPLOYMENT_tract_C$`2019` - EMPLOYMENT_tract_C$`2013`
EMPLOYMENT_tract_C
<- rbind(slice_min(EMPLOYMENT_tract_C, order_by = abs(Delta), n= 1),
Change slice_max(EMPLOYMENT_tract_C, order_by = (Delta), n= 1),
slice_min(EMPLOYMENT_tract_C, order_by = (Delta), n= 1))
= c("Most Stable","Greatest Increase", "Greatest Decrease")
names
<- left_join(EMPLOYMENT_tract, cbind(Change,names), "tract")
EMPLOYMENT_tract
= EMPLOYMENT_tract
df
<-
Plot ggplot(data = df, aes(y = estimate, x = year, group = year)) + geom_boxplot(color = "azure4", fill = "linen") + geom_point(alpha = 0.3, color = "darkgrey") + geom_line(aes(group = tract), alpha = 0.09) +
geom_line(
data = subset(
df,%in% c("Greatest Increase", "Most Stable", "Greatest Decrease")
names
),aes(
group = tract,
color = paste0(names, " (Tract ", tract, ", ", round(Delta), "%", ")")
),size = 1.25
+
) scale_color_discrete(name = "") +
::theme_pubr() +
ggpubrylab("Percent of Population 16+ Unemployed") +
xlab("Year") +
ggtitle(label = "Percent Change in Population Percent 16+ Unemployed, 2013-2019", subtitle = "Census Tracts San Antonio Promise Zone") +
theme(
plot.title = element_text(
size = 12,
face = "bold",
family = "Sans", hjust = 0.5
axis.title.x = element_text(face = "bold", size = 9),
),axis.title.y = element_text(face = "bold", size =9),
legend.spacing.x = unit(0.2, 'cm'), plot.subtitle = element_text(hjust = 0.5),
legend.background = element_rect(color = "white", fill = "snow2"), legend.text = element_text(size = 7.5), legend.direction = "horizontal", legend.position = "top", plot.caption = element_text(size =8, color = "darkgrey"), plot.background = element_rect(color = "black", fill = NA)
+labs(caption= "Source: American Community Survey \n Authors: Julia Kay Wolf, Drew Schaefer, Jacob M. Souch")
)
Plot
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database
Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
family not found in Windows font database