diff --git a/Prog/2026/RFK/1.Identify RFK Adjacent Tracts.Rmd b/Prog/2026/RFK/1.Identify RFK Adjacent Tracts.Rmd index b9ff791..5b840e3 100644 --- a/Prog/2026/RFK/1.Identify RFK Adjacent Tracts.Rmd +++ b/Prog/2026/RFK/1.Identify RFK Adjacent Tracts.Rmd @@ -14,12 +14,17 @@ RFK Stadium Parcel: https://www.ncpc.gov/files/projects/2026/8721_New_Stadium_at ```{r} + +#install.packages("ggspatial") + library(tidyverse) library(sf) library(ggplot2) library(urbnthemes) library(urbnmapr) set_urbn_defaults(style = "map") +library(ggspatial) + ``` ```{r load data} @@ -36,6 +41,9 @@ anc <- st_read("//sas1/dcdata/Libraries/OCTO/Maps/Advisory_Neighborhood_Commissi roads <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Roads/Roads.shp") +water <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Waterbodies_2023/Waterbodies_2023.shp") %>% + mutate(water = "Waterways") + metro <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Metro_Stations_Regional/Metro_Stations_Regional.shp") %>% mutate(line1 = case_when(LINE == "blue, yellow"~ "yellow", LINE == "blue, orange, silver"~ "blue", @@ -57,8 +65,6 @@ bus <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Metro_Bus_St national_parks <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/National_Parks/National_Parks.shp") %>% mutate(parks = "National Parks") -wards <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Ward_-_2022/Ward_-_2022.shp") - build_permits <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Building_Permits_in_2025/Building_Permits_in_2025.shp") rfk_permit <- build_permits %>% filter(OBJECTID == 1097829048) %>% @@ -126,18 +132,26 @@ tract2 <- tracts %>% # Add census tracts 7803, 7806, and 7809 (Minnesota Ave Metro), Kennilworth and Eastwood gardens # and remove the arboretum, 11100 mutate(rfk_group = if_else(in_a_mile == 1, 1, 0), - rfk_group = if_else(TRACT %in% c("007803", "007806", "007809"), 1, rfk_group), + rfk_group = if_else(TRACT %in% c("007803", "007806", "007809", "009906"), 1, rfk_group), rfk_group = if_else(TRACT == "011100", 0, rfk_group), - east_of_anacostia = if_else(TRACT %in% c("007709", "007708", "007601", "007604", "009901", "007703", "009604", "009603", "009602", "007803", "009601", "007806", "007809"), 1, 0), + east_of_anacostia = if_else(TRACT %in% c("007709", "007708", "007601", "007604", "009901", "007703", "009604", "009603", "009602", "007803", "009601", "007806", "007809", "009906"), 1, 0), west_of_anacostia = if_else(rfk_group == 1 & east_of_anacostia == 0, 1, 0), rfk_sub_group = case_when(east_of_anacostia == 1 ~ "RFK-East of Anacostia", - west_of_anacostia == 1 ~ "RFK-West of Anacostia")) + west_of_anacostia == 1 ~ "RFK-West of Anacostia"), + rfk_sub_group2 = case_when(east_of_anacostia == 1 ~ "East of Anacostia", + west_of_anacostia == 1 ~ "West of Anacostia")) rfk_tracts <- tract2 %>% filter(rfk_group == 1) rfk_outline <- rfk_tracts %>% st_union() + +rfk_save <- tract2 %>% + select(GEOID, rfk_group, east_of_anacostia, west_of_anacostia, rfk_sub_group, rfk_sub_group2) %>% + st_drop_geometry() + +write.csv(rfk_save, "//Sas1/dcdata/Libraries/Requests/Prog/2026/RFK/result/rfk_tracts.csv") ``` map result @@ -198,96 +212,111 @@ dcxmax = max(dccoords$X) full_map <- ggplot() + #RFK focus area geom_sf(data = rfk_tracts, aes(geometry = geometry, fill = rfk_sub_group), colour = NA) + - geom_sf(data = rfk_outline, color = "#000000", size = 1, fill = NA) + #National Parks geom_sf(data = national_parks, aes(geometry = geometry, fill = parks), colour = NA, alpha = 0.5) + + #Water + geom_sf(data = water, aes(geometry = geometry, fill = water), colour = NA, alpha = 0.5) + #RFK Development geom_sf(data = rfk, aes(geometry = geometry, fill = label), colour = NA) + #Wards - geom_sf(data = wards, aes(geometry = geometry), colour = "#000000", fill = NA) + + geom_sf(data = wards, aes(geometry = geometry), colour = "#5c5859", fill = NA) + #Metro Stops geom_sf(data = dc_metro, aes(geometry = geometry, colour = line_color), fill = NA, size = 2) + scale_color_identity(guide = "legend", name = "Metro Stops")+ #Area legend - scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks"), values = c("#ec008b", "#fce39e", "#a2d4ec", "#98cf90"), name = "Legend") + + scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks", "Waterways"), values = c("#000000", "#fdbf11", "#ec008b", "#98cf90", "#73BFE2"), name = "Legend") + #Ward names - geom_sf_text(data = wards, aes(geometry = geometry, label = paste0("Ward ", WARD_ID)), colour = "#000000", size = 3) + + geom_sf_text(data = wards, aes(geometry = geometry, label = paste0("Ward ", WARD_ID)), colour = "#5c5859", size = 3) + + #RFK area outline + geom_sf(data = rfk_outline, color = "#000000", size = 3, fill = NA) + #Filter to DC coord_sf( xlim = c(dcxmin, dcxmax), ylim = c(dcymin, dcymax), - expand = FALSE) + expand = FALSE) + + #distance label + annotation_scale() full_map -ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/full_map.png", +ggsave(#filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Results/Geography & ACS/full_map.png", + filename = "C:/Users/kvisalli/Box/Greater DC/Projects/RFK Stadium Analysis/Results/Geography & ACS/full_map.png", plot = full_map, device = "png", width = 6.5, dpi = 1000) - -#Zoomed in Map with ANC -full_map_zoom_anc <- ggplot() + - #RFK focus area - geom_sf(data = rfk_tracts, aes(geometry = geometry, fill = rfk_sub_group), colour = NA) + - geom_sf(data = rfk_outline, color = "#000000", size = 1, fill = NA) + - #National Parks - geom_sf(data = national_parks, aes(geometry = geometry, fill = parks), colour = NA, alpha = 0.5) + - #RFK Development - geom_sf(data = rfk, aes(geometry = geometry, fill = label), colour = NA) + - #Area legend - scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks"), values = c("#ec008b", "#fce39e", "#a2d4ec", "#98cf90"), name = "Legend") + - #ANC - geom_sf(data = anc, aes(geometry = geometry), colour = "#332d2f", fill = NA) + - geom_sf_text(data = anc, aes(geometry = geometry, label = paste0(NAME)), colour = "#332d2f", size = 3) + - #Wards - geom_sf(data = wards, aes(geometry = geometry), colour = "#000000", fill = NA) + - geom_sf(data = rfk, aes(geometry = geometry, fill = label), colour = NA) + - #Metro stops - geom_sf(data = dc_metro, aes(geometry = geometry, colour = line_color), fill = NA, size = 2) + - scale_color_identity(guide = "legend", name = "Metro Stops") + - #Zoom in - coord_sf( - xlim = c(xmin, xmax), - ylim = c(ymin, ymax), - expand = FALSE) -full_map_zoom_anc - - -ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/full_map_zoom_anc.png", - plot = full_map_zoom_anc, - device = "png", - width = 6.5, - dpi = 1000) +# +# #Zoomed in Map with ANC +# full_map_zoom_anc <- ggplot() + +# #RFK focus area +# geom_sf(data = rfk_tracts, aes(geometry = geometry, fill = rfk_sub_group), colour = NA) + +# #National Parks +# geom_sf(data = national_parks, aes(geometry = geometry, fill = parks), colour = NA, alpha = 0.5) + +# #RFK Development +# geom_sf(data = rfk, aes(geometry = geometry, fill = label), colour = NA) + +# #Area legend +# scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks"), values = c("#000000", "#fdbf11", "#ec008b", "#98cf90"), name = "Legend") + +# #ANC +# geom_sf(data = anc, aes(geometry = geometry), colour = "#5c5859", fill = NA) + +# geom_sf_text(data = anc, aes(geometry = geometry, label = paste0(NAME)), colour = "#5c5859", size = 3) + +# #Wards +# geom_sf(data = wards, aes(geometry = geometry), colour = "#5c5859", fill = NA) + +# geom_sf(data = rfk, aes(geometry = geometry, fill = label), colour = NA) + +# #Metro stops +# geom_sf(data = dc_metro, aes(geometry = geometry, colour = line_color), fill = NA, size = 2) + +# scale_color_identity(guide = "legend", name = "Metro Stops") + +# #RFK area outline +# geom_sf(data = rfk_outline, color = "#000000", size = 2, fill = NA) + +# #Zoom in +# coord_sf( +# xlim = c(xmin, xmax), +# ylim = c(ymin, ymax), +# expand = FALSE) + +# #distance label +# annotation_scale(pad_x = unit(5, "cm")) +# full_map_zoom_anc +# +# +# ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/full_map_zoom_anc.png", +# plot = full_map_zoom_anc, +# device = "png", +# width = 6.5, +# dpi = 1000) #Zoomed in Map with census tracts full_map_zoom_tract <- ggplot() + #RFK focus area geom_sf(data = rfk_tracts, aes(geometry = geometry, fill = rfk_sub_group), colour = NA) + - geom_sf(data = rfk_outline, color = "#000000", size = 1, fill = NA) + #National Parks geom_sf(data = national_parks, aes(geometry = geometry, fill = parks), colour = NA, alpha = 0.5) + + #Water + geom_sf(data = water, aes(geometry = geometry, fill = water), colour = NA, alpha = 0.5) + #RFK Development geom_sf(data = rfk, aes(geometry = geometry, fill = label), colour = NA) + #Area legend - scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks"), values = c("#ec008b", "#fce39e", "#a2d4ec", "#98cf90"), name = "Legend") + - #Consus Tracts - geom_sf(data = tract2, aes(geometry = geometry), fill = NA, colour = "#332d2f") + + scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks", "Waterways"), values = c("#000000", "#fdbf11", "#ec008b", "#98cf90", "#73BFE2"), name = "Legend") + + #Census Tracts + geom_sf(data = tract2, aes(geometry = geometry), fill = NA, colour = "#5c5859") + #Ward - geom_sf(data = wards, aes(geometry = geometry), colour = "#000000", fill = NA) + + geom_sf(data = wards, aes(geometry = geometry), colour = "#5c5859", fill = NA) + #Metro geom_sf(data = dc_metro, aes(geometry = geometry, colour = line_color), fill = NA, size = 2) + - scale_color_identity(guide = "legend", name = "Metro Stops") + + scale_color_identity(guide = "legend", name = "Metro Stops") + + #RFK area outline + geom_sf(data = rfk_outline, color = "#000000", size = 3, fill = NA) + #Zoom in coord_sf( xlim = c(xmin, xmax), ylim = c(ymin, ymax), - expand = FALSE) + expand = FALSE) + + #distance label + annotation_scale(pad_x = unit(5, "cm")) full_map_zoom_tract -ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/full_map_zoom_tract.png", +ggsave(#filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Results/Geography & ACS/full_map_zoom_tract.png", + filename = "C:/Users/kvisalli/Box/Greater DC/Projects/RFK Stadium Analysis/Results/Geography & ACS/full_map_zoom_tract.png", plot = full_map_zoom_tract, device = "png", width = 6.5, @@ -297,29 +326,35 @@ ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/full_ma full_map_zoom_roads <- ggplot() + #RFK focus area geom_sf(data = rfk_tracts, aes(geometry = geometry, fill = rfk_sub_group), colour = NA) + - geom_sf(data = rfk_outline, color = "#000000", size = 1, fill = NA) + #National Parks geom_sf(data = national_parks, aes(geometry = geometry, fill = parks), colour = NA, alpha = 0.5) + + #Water + geom_sf(data = water, aes(geometry = geometry, fill = water), colour = NA, alpha = 0.5) + #RFK Development geom_sf(data = rfk, aes(geometry = geometry, fill = label), colour = NA) + #Area legend - scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks"), values = c("#ec008b", "#fce39e", "#a2d4ec", "#98cf90"), name = "Legend") + + scale_fill_manual(breaks = c("RFK Stadium & Campus", "RFK-West of Anacostia", "RFK-East of Anacostia", "National Parks", "Waterways"), values = c("#000000", "#fdbf11", "#ec008b", "#98cf90", "#73BFE2"), name = "Legend") + #Roads - geom_sf(data = roads, aes(geometry = geometry), colour = "#9d9d9d", fill = NA, size = 0.05) + - #Wards - geom_sf(data = wards, aes(geometry = geometry), colour = "#000000", fill = NA) + + geom_sf(data = roads, aes(geometry = geometry), colour = "#5c5859", fill = NA, size = 0.05) + + # #Wards + # geom_sf(data = wards, aes(geometry = geometry), colour = "#000000", fill = NA) + #Metro geom_sf(data = dc_metro, aes(geometry = geometry, colour = line_color), fill = NA, size = 2) + - scale_color_identity(guide = "legend", name = "Metro Stops") + + scale_color_identity(guide = "legend", name = "Metro Stops") + + #RFK area outline + geom_sf(data = rfk_outline, color = "#000000", size = 3, fill = NA) + #Zoom in coord_sf( xlim = c(xmin, xmax), ylim = c(ymin, ymax), - expand = FALSE) + expand = FALSE) + + #distance label + annotation_scale(pad_x = unit(5, "cm")) full_map_zoom_roads -ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/full_map_zoom_roads.png", +ggsave(#filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Results/Geography & ACS/full_map_zoom_roads.png", + filename = "C:/Users/kvisalli/Box/Greater DC/Projects/RFK Stadium Analysis/Results/Geography & ACS/full_map_zoom_roads.png", plot = full_map_zoom_roads, device = "png", width = 6.5, diff --git a/Prog/2026/RFK/ACS summary stats.sas b/Prog/2026/RFK/ACS summary stats.sas index 0afd0a7..3f7cd41 100644 --- a/Prog/2026/RFK/ACS summary stats.sas +++ b/Prog/2026/RFK/ACS summary stats.sas @@ -141,6 +141,24 @@ left join rfk_tracts as b on a.tract2 = b.tract2; quit; +*dummy variables for each area; +data tracts3; + set tracts2; + dc = 1; + if ward2022 = 7 then ward7 = 1; + else ward7 = 0; +run; + +/*** Find households under 80% AMI +87,896 from https://www.census.gov/quickfacts/fact/table/DC/INC110224 +*/ + sum(incmbyownercst_lt10k_2020_24) as ownerinc_lt10k, + sum(incmbyownercst_10_19k_2020_24) as ownerinc_10_19k, + sum(incmbyownercst_20_34k_2020_24) as ownerinc_20_34k, + sum(incmbyownercst_35_49k_2020_24) as ownerinc_35_49k, + sum(incmbyownercst_50_74k_2020_24) as ownerinc_50_74k, + + *create Summary Statistics, census tracts in RFK sub groups (East & West of Anacostia); proc sql; create table sub_summary_stats as select /* census tract */ diff --git a/Prog/2026/RFK/Displacement Risk.Rmd b/Prog/2026/RFK/Displacement Risk.Rmd new file mode 100644 index 0000000..376563b --- /dev/null +++ b/Prog/2026/RFK/Displacement Risk.Rmd @@ -0,0 +1,184 @@ +--- +title: "displacement risk" +author: "Katie Visalli" +date: "2026-06-29" +output: html_document +--- + +```{r set up} +library(tidyverse) +library(tidylog) +library(openxlsx) +library(ggplot2) +library(sf) +library(urbnthemes) +library(urbnmapr) +set_urbn_defaults(style = "map") +``` + +```{r load data} +rfk_tracts <- read.csv("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/rfk_tracts.csv") + +cat_order <- c("Highest", "Higher", "Intermediate", "Lower", "Lowest") + +displacement_risk <- read.xlsx("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Displacement Risk and Neighborhood Change.xlsx") %>% + mutate(across(c(population_vulnerability_cat, housing_condition_cat, market_pressure_cat, displacement_cat), ~ordered(.x, levels = cat_order))) + +tracts <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Census_Tracts_in_2020/Census_Tracts_in_2020.shp") %>% + select(GEOID, geometry) %>% + mutate(GEOID = as.numeric(GEOID)) + +rfk_tracts_shape <- rfk_tracts %>% + left_join(tracts, by = "GEOID") + +displacement_risk_shape <- displacement_risk %>% + left_join(tracts, by = "GEOID") + +displacement_risk_rfk <- displacement_risk %>% + left_join(rfk_tracts, by = "GEOID") %>% + mutate(ward7 = if_else(Ward == "Ward 7", 1, 0)) +``` + +```{r map prep} +#for outlines of the RFK areas +west_outline <- rfk_tracts_shape %>% + filter(west_of_anacostia == 1) + +east_outline <- rfk_tracts_shape %>% + filter(east_of_anacostia == 1) + +outlines <- ggplot()+ + geom_sf(data = west_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + geom_sf(data = east_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + scale_color_manual(values = c("#ec008b", "#fdbf11"), name = "RFK Area Sub-Group") +outlines +``` + +```{r} +population_vulnerability <- ggplot() + + geom_sf(data = displacement_risk_shape, aes(geometry = geometry, fill = factor(population_vulnerability_cat, levels = cat_order)), color = NA) + + scale_fill_manual(name = "Population Vulnerability", values = c("#062635","#12719E","#1696D2","#73BFE2","#CFE8F3")) + + geom_sf(data = west_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + geom_sf(data = east_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + scale_color_manual(values = c("#ec008b", "#fdbf11"), name = "RFK Area Sub-Group") +population_vulnerability + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/displacement vulnerability/map population_vulnerability.png", + plot = population_vulnerability, + device = "png", + width = 6.5, + dpi = 1000) + +housing_condition <- ggplot() + + geom_sf(data = displacement_risk_shape, aes(geometry = geometry, fill = factor(housing_condition_cat, levels = cat_order)), color = NA) + + scale_fill_manual(name = "Housing Condition", values = c("#062635","#12719E","#1696D2","#73BFE2","#CFE8F3")) + + geom_sf(data = west_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + geom_sf(data = east_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + scale_color_manual(values = c("#ec008b", "#fdbf11"), name = "RFK Area Sub-Group") +housing_condition + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/displacement vulnerability/map housing_condition.png", + plot = housing_condition, + device = "png", + width = 6.5, + dpi = 1000) + +market_pressure <- ggplot() + + geom_sf(data = displacement_risk_shape, aes(geometry = geometry, fill = factor(market_pressure_cat, levels = cat_order)), color = NA) + + scale_fill_manual(name = "Market Pressure", values = c("#062635","#12719E","#1696D2","#73BFE2","#CFE8F3")) + + geom_sf(data = west_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + geom_sf(data = east_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + scale_color_manual(values = c("#ec008b", "#fdbf11"), name = "RFK Area Sub-Group") +market_pressure + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/displacement vulnerability/map market_pressure.png", + plot = market_pressure, + device = "png", + width = 6.5, + dpi = 1000) + +displacement <- ggplot() + + geom_sf(data = displacement_risk_shape, aes(geometry = geometry, fill = factor(displacement_cat, levels = cat_order)), color = NA) + + scale_fill_manual(name = "Displacement", values = c("#062635","#12719E","#1696D2","#73BFE2","#CFE8F3")) + + geom_sf(data = west_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + geom_sf(data = east_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + scale_color_manual(values = c("#ec008b", "#fdbf11"), name = "RFK Area Sub-Group") +displacement + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/displacement vulnerability/map displacement.png", + plot = displacement, + device = "png", + width = 6.5, + dpi = 1000) + +neighborhood_type <- ggplot() + + geom_sf(data = displacement_risk_shape, aes(geometry = geometry, fill = neighborhoodtype), color = NA) + + scale_fill_manual(name = "Neighborhood Type", values = c("#1696D2","#A2D4EC", "#000000", "#9D9D9D")) + + geom_sf(data = west_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + geom_sf(data = east_outline, aes(geometry = geometry, color = rfk_sub_group), fill = NA) + + scale_color_manual(values = c("#ec008b", "#fdbf11"), name = "RFK Area Sub-Group") +neighborhood_type + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/displacement vulnerability/map neighborhood_type.png", + plot = neighborhood_type, + device = "png", + width = 6.5, + dpi = 1000) + +``` + +```{r tables} +wb <- createWorkbook() + +tab_population_vulnerability <- displacement_risk_rfk %>% + group_by(population_vulnerability_cat) %>% + summarise(DC = n(), + ward7 = sum(ward7), + RFK = sum(rfk_group), + east_of_anacostia = sum(east_of_anacostia), + west_of_anacostia = sum(west_of_anacostia)) +addWorksheet(wb, "population_vulnerability") +writeData(wb, "population_vulnerability", tab_population_vulnerability) + +tab_housing_condition <- displacement_risk_rfk %>% + group_by(housing_condition_cat) %>% + summarise(DC = n(), + ward7 = sum(ward7), + RFK = sum(rfk_group), + east_of_anacostia = sum(east_of_anacostia), + west_of_anacostia = sum(west_of_anacostia)) +addWorksheet(wb, "housing_condition") +writeData(wb, "housing_condition", tab_housing_condition) + +tab_market_pressure <- displacement_risk_rfk %>% + group_by(market_pressure_cat) %>% + summarise(DC = n(), + ward7 = sum(ward7), + RFK = sum(rfk_group), + east_of_anacostia = sum(east_of_anacostia), + west_of_anacostia = sum(west_of_anacostia)) +addWorksheet(wb, "market_pressure") +writeData(wb, "market_pressure", tab_market_pressure) + +tab_displacement <- displacement_risk_rfk %>% + group_by(displacement_cat) %>% + summarise(DC = n(), + ward7 = sum(ward7), + RFK = sum(rfk_group), + east_of_anacostia = sum(east_of_anacostia), + west_of_anacostia = sum(west_of_anacostia)) +addWorksheet(wb, "displacement") +writeData(wb, "displacement", tab_displacement) + +tab_neighborhood_type <- displacement_risk_rfk %>% + group_by(neighborhoodtype) %>% + summarise(DC = n(), + ward7 = sum(ward7), + RFK = sum(rfk_group), + east_of_anacostia = sum(east_of_anacostia), + west_of_anacostia = sum(west_of_anacostia)) +addWorksheet(wb, "neighborhood_type") +writeData(wb, "neighborhood_type", tab_neighborhood_type) + +saveWorkbook(wb, "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/displacement vulnerability/tables.xlsx") +``` \ No newline at end of file diff --git a/Prog/2026/RFK/Ownership Property Data.sas b/Prog/2026/RFK/Ownership Property Data.sas new file mode 100644 index 0000000..733a2d1 --- /dev/null +++ b/Prog/2026/RFK/Ownership Property Data.sas @@ -0,0 +1,355 @@ + +/* +Project: RFK Stadium DCData +Author: Katie Visalli +Date: 6/24/26 + +Property ownership +Source: Realprop.Parcel_base_who_owns +Universe: All active [in_last_ownerpt=1] residential [ui_proptype=10,11,12,13,19] property parcels + +Parcels by property type [ui_proptype] and owner type [ownercat] +Single family houses [ui_proptype=10] by owner-occupancy [owner_occ_sale] +Single family houses [ui_proptype=10] with senior homestead exemption [hstd_code=5] +Condominium units [ui_proptype=11] by owner-occupancy [owner_occ_sale] +Condominium units [ui_proptype=11] with senior homestead exemption [hstd_code=5] + +on RFK areas and Ward2022 +*/ + +* Set Up; +%include "F:\DCDATA\SAS\Inc\StdRemote.sas"; + +* Data Libraries ; +%DCData_lib(REALPROP) +%DCData_lib(DHCD) + +*Load data +Universe: All active [in_last_ownerpt=1] residential [ui_proptype=10,11,12,13,19] property parcels; +data ownership; + set REALPROP.Parcel_base_who_owns; + where in_last_ownerpt=1 AND ui_proptype IN ("10","11","12","13","19") AND hstd_code ~= "3"; +run; + +* Load Geo data; +data parcel_geo; + set REALPROP.parcel_geo; + census_tract = input(geo2020, 10.); +run; + +* merge geo to ownership data; +proc sql; create table ownership_geo as select + * + from Ownership as a left join parcel_geo as b + on a.ssl = b.ssl; +quit; + +* Read in RFK tracts; +proc import + out = rfk_tracts + datafile = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/rfk_tracts.csv" + DBMS = csv REPLACE; +run; + +data rfk_tracts; +set rfk_tracts; +censustract = input(geoid, 10.); +run; + +* Load rent control data; +data rent_control; +set dhcd.parcels_rent_control; +run; + + +*merge RFK and Ownership Data; +proc sql; create table rfk_ownership as select + * + from Ownership_geo as a left join rfk_tracts as b + on a.census_tract = b.censustract; +quit; + +*dummy variables for each area; +data rfk_ownership2; + set rfk_ownership; + dc = 1; + if ward2022 = 7 then ward7 = 1; + else ward7 = 0; + if ownercat IN ("010", "020") then owner_occupied = 1; + else owner_occupied = 0; +run; + + +*merge multifamily properties to rent conrol data (Residential-multifamily, ; +proc sql; create table rfk_rent_control as select + * + from rfk_ownership2(where = (ui_proptype IN ("11", "13", "19", "12"))) as a left join rent_control as b + on a.ssl = b.ssl; +quit; + +*re-combine the ownership-property data that was and wan't merged to rent control data; +proc append base=rfk_rent_control data=rfk_ownership2(where = (ui_proptype IN ("10"))); +run; + +*remove duplicates on ssl 177626 observations; +proc sort data = rfk_rent_control out = rfk_rent_control_nodup nodupkey; + by ssl; +run; + +*assign number of units as 1 when singlefamily or condo; +data rfk_rent_control_nodup2; + set rfk_rent_control_nodup; + if ui_proptype IN ("10", "11") then unit_count = 1; + else if units_mar ~=. then unit_count = units_mar; + else unit_count = 1; +run; + +/* Cooperative buildings do not merge to rent control data, so we do not know how many units they have from MAR file; +data coop_check; +set rfk_rent_control_nodup2(where = (ui_proptype = "12")); +run; +*/ + + +*check owner occupancy vars; +proc sql; create table ownerocc_check as select + owner_occ_sale, owner_occupied, sum(rfk_group) as rfk +from rfk_rent_control_nodup2 +group by owner_occ_sale, owner_occupied; +quit; + +proc print data = ownerocc_check; +run; + +/************************************************************** Property Type & Ownership Tables **************************************************************/ + +/* Number of Units by property Type and area */ +proc sql; create table proptype_units as select + ui_proptype, + sum(dc * unit_count) as DC, + sum(ward7 * unit_count) as Ward7, + sum(rfk_group * unit_count) as RFK, + sum(east_of_anacostia * unit_count) as East_RFK, + sum(west_of_anacostia * unit_count) as West_RFK + from rfk_rent_control_nodup2 + group by ui_proptype; +quit; + +proc print data = proptype_units; +run; + + +/* Number of Units by owner type and area */ +proc sql; create table owner_units as select + ownercat, + sum(dc * unit_count) as DC, + sum(ward7 * unit_count) as Ward7, + sum(rfk_group * unit_count) as RFK, + sum(east_of_anacostia * unit_count) as East_RFK, + sum(west_of_anacostia * unit_count) as West_RFK + from rfk_rent_control_nodup2(where = (ui_proptype ~= "12")) + group by ownercat; +quit; + +proc report data = owner_units; +run; + + +* Parcels by property type [ui_proptype] and owner type [ownercat] by areas; +proc sql; create table proptype_owner_units as select + ui_proptype, ownercat, + sum(dc * unit_count) as DC, + sum(ward7 * unit_count) as Ward7, + sum(rfk_group * unit_count) as RFK, + sum(east_of_anacostia * unit_count) as East_RFK, + sum(west_of_anacostia * unit_count) as West_RFK + from rfk_rent_control_nodup2 + group by ui_proptype, ownercat; +quit; + +proc print data = proptype_owner_units; +run; + +/************************************************************** Homestead Exemptions **************************************************************/ + +*Single family houses [ui_proptype=10] by owner-occupancy [owner_occ_sale]; +proc sql; create table sf_ownership as select + owner_occ_sale, + sum(dc) as DC, + sum(ward7) as Ward7, + sum(rfk_group) as RFK, + sum(east_of_anacostia) as East_RFK, + sum(west_of_anacostia) as West_RFK + from rfk_rent_control_nodup2(where = (ui_proptype ="10")) + group by owner_occ_sale; +quit; + +proc print data = sf_ownership; +run; + +proc export data=sf_ownership + outfile="\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Result\property_ownership_result.xlsx" + dbms=xlsx + replace; + sheet="sf_ownership"; +run; + +*Single family houses [ui_proptype=10] with senior homestead exemption [hstd_code=5]; +proc sql; create table sf_homestead as select + owner_occ_sale, hstd_code, + sum(dc) as DC, + sum(ward7) as Ward7, + sum(rfk_group) as RFK, + sum(east_of_anacostia) as East_RFK, + sum(west_of_anacostia) as West_RFK + from rfk_rent_control_nodup2(where = (ui_proptype ="10")) /*AND (input(hstd_code, 10.)=5));*/ + group by owner_occ_sale, hstd_code; +quit; + +proc print data = sf_homestead; +run; + +proc export data=sf_homestead + outfile="\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Result\property_ownership_result.xlsx" + dbms=xlsx + replace; + sheet="sf_homestead"; +run; + + +*Condominium units [ui_proptype=11] by owner-occupancy [owner_occ_sale]; +proc sql; create table co_ownership as select + owner_occ_sale, + sum(dc) as DC, + sum(ward7) as Ward7, + sum(rfk_group) as RFK, + sum(east_of_anacostia) as East_RFK, + sum(west_of_anacostia) as West_RFK + from rfk_rent_control_nodup2(where =((input(ui_proptype, 10.)=11))) /*AND (input(hstd_code, 10.)=5));*/ + group by owner_occ_sale; +quit; + +proc print data = co_ownership; +run; + +proc export data=co_ownership + outfile="\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Result\property_ownership_result.xlsx" + dbms=xlsx + replace; + sheet="co_ownership"; +run; + +*Condominium units [ui_proptype=11] with senior homestead exemption [hstd_code=5]; +proc sql; create table co_homestead as select + owner_occ_sale, hstd_code, + sum(dc) as DC, + sum(ward7) as Ward7, + sum(rfk_group) as RFK, + sum(east_of_anacostia) as East_RFK, + sum(west_of_anacostia) as West_RFK + from rfk_rent_control_nodup2(where =((input(ui_proptype, 10.)=11))) /*AND (input(hstd_code, 10.)=5));*/ + group by owner_occ_sale, hstd_code; +quit; + +proc print data = co_homestead; +run; + +proc export data=co_homestead + outfile="\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Result\property_ownership_result.xlsx" + dbms=xlsx + replace; + sheet="co_homestead"; +run; + + +/************************************************************** Rent Control **************************************************************/ +*shares of rental properties that have rent control by area; +proc sql; create table rent_control as select + Rent_controlled, + sum(dc) as DC, + sum(ward7) as Ward7, + sum(rfk_group) as RFK, + sum(east_of_anacostia) as East_RFK, + sum(west_of_anacostia) as West_RFK +from rfk_rent_control_nodup2 (where = (ui_proptype = "13")) +group by Rent_controlled; +quit; + +proc export data=rent_control + outfile="\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Result\property_ownership_result.xlsx" + dbms=xlsx + replace; + sheet="rent_control"; +run; + + +/************************************************************** Length of Ownership **************************************************************/ +*Year breakdown of last saledate; +*get year; +data ownerhip_length_data; +set rfk_rent_control_nodup2; +sale_year = year(SALEDATE); +if DC =0 then DC = .; +if Ward7 =0 then Ward7 = .; +if rfk_group =0 then rfk_group = .; +if east_of_anacostia =0 then east_of_anacostia = .; +if west_of_anacostia =0 then west_of_anacostia = .; +run; + +*find quantiles of last sale year; +proc univariate data=ownerhip_length_data; + var sale_year; + output out=stats pctlpts=10 25 50 75 90 pctlpre=p; +run; + +*define categorical variable; +data ownerhip_length_data2; +set ownerhip_length_data; +length own_length_cat $ 20 ; +if sale_year <2000 then own_length_cat = "a.1999 and earlier"; + else if sale_year >= 2000 & sale_year <2010 then own_length_cat = "b.2000-2009"; + else if sale_year >= 2010 & sale_year <2015 then own_length_cat = "c.2010-2014"; + else if sale_year >= 2015 & sale_year <2020 then own_length_cat = "d.2015-2019"; + else if sale_year >= 2020 & sale_year <2023 then own_length_cat = "e.2020-2022"; + else if sale_year >= 2023 then own_length_cat = "f.2023 and after"; +if owner_occ_sale = 1 then owner_occ = "yes"; + else if owner_occ_sale IN ("N", "0") then owner_occ = "no"; +run; + +*table results; +proc sql; create table length_of_ownership as select + owner_occ, own_length_cat, + sum(dc) as DC, + sum(ward7) as Ward7, + sum(rfk_group) as RFK, + sum(east_of_anacostia) as East_RFK, + sum(west_of_anacostia) as West_RFK + from ownerhip_length_data2 (where = (owner_occ ~="")) +group by owner_occ, own_length_cat; +quit; + +proc export data=length_of_ownership + outfile="\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Result\property_ownership_result.xlsx" + dbms=xlsx + replace; + sheet="length_of_ownership"; +run; + +*median length of ownership; +proc sql; create table median_length_of_ownership as select + owner_occ, + median(sale_year * DC) as DC, + median(sale_year * Ward7) as Ward7, + median(sale_year * rfk_group) as RFK, + median(sale_year * east_of_anacostia) as East_RFK, + median(sale_year * west_of_anacostia) as West_RFK + from ownerhip_length_data2 (where = (owner_occ ~="")) +group by owner_occ; +quit; + +proc export data=median_length_of_ownership + outfile="\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Result\property_ownership_result.xlsx" + dbms=xlsx + replace; + sheet="med_length_of_ownership"; +run; diff --git a/Prog/2026/RFK/Property Data.sas b/Prog/2026/RFK/Property Data.sas new file mode 100644 index 0000000..31ec635 --- /dev/null +++ b/Prog/2026/RFK/Property Data.sas @@ -0,0 +1,122 @@ +/* +Project: RFK Stadium DCData +Author: Katie Visalli +Date: 6/12/26 + +Property data to compile for RFK stadium analysis. + +Property sales +Source: Realprop.Sales_res_clean +Universe: Residential property sales, 2000 - 2025 [saledate] + +Single family houses [ui_proptype=10] +Number of sales by year +Median sales price (2025 $) by year +Condominiums [ui_proptype=11] +Number of sales by year +Median sales price (2025 $) by year + +on RFK areas and Ward2022 +*/ + + +* Set Up; +%include "F:\DCDATA\SAS\Inc\StdRemote.sas"; + +* Data Libraries ; +%DCData_lib(REALPROP) + +* load Data and filter to saledate from 2000-2025; +data sales; +set REALPROP.sales_res_clean; +*esale_date = input(SALEDATE, ddmmyy10.); +sale_year = year(SALEDATE); +if sale_year <= 2025 AND sale_year >= 2000; +censustract = input(geo2020, 10.); +run; + +*Convert dollar values to 2025 for sales price; +data sales2; +set sales; + %dollar_convert(SALEPRICE, SALEPRICE_2025, + sale_year, 2025, + series = CUUR0000SA0L2, + quiet=N); +run; + + +/* +* Read in RFK tracts; +proc import + out = rfk_tracts + datafile = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/rfk_tracts.csv" + DBMS = csv REPLACE; +run; + +data rfk_tracts; +set rfk_tracts; +censustract = input(geoid, 10.); +run; + +*merge RFK tracts with property data; +proc sql; create table sales_rfk as select + * + from rfk_tracts as a left join sales2 as b + on a.censustract = b.censustract; +quit; + + +* stats by RFK sub group; +proc sql; create table sumstats_subgroup as select + rfk_sub_group2, sale_year, ui_proptype, + count(ssl) as sales, + /* median sales price + median(saleprice_2025) as med_price + from sales_rfk + group by rfk_sub_group2, sale_year, ui_proptype; +quit; + +proc print data=sumstats_subgroup; +run; + +* stats by RFK full group; +proc sql; create table sumstats_rfk as select + rfk_group, sale_year, ui_proptype, + /* number of sales + count(ssl) as sales, + /* median sales price + median(saleprice_2025) as med_price + from sales_rfk + group by rfk_group, sale_year, ui_proptype; +quit; + +proc print data=sumstats_rfk; +run; + +* stats by ward; +proc sql; create table sumstats_ward as select + ward2022, sale_year, ui_proptype, + /* number of sales + count(ssl) as sales, + /* median sales price + median(saleprice_2025) as med_price + from sales_rfk + group by ward2022, sale_year, ui_proptype; +quit; + +proc print data=sumstats_ward; +run; + +* stats in all of DC; +proc sql; create table sumstats_dc as select + sale_year, ui_proptype, + /* number of sales + count(ssl) as sales, + /* median sales price + median(saleprice_2025) as med_price + from sales_rfk + group by sale_year, ui_proptype; +quit; + +proc print data=sumstats_dc; +run; diff --git a/Prog/2026/RFK/README.md b/Prog/2026/RFK/README.md new file mode 100644 index 0000000..2e9eab5 --- /dev/null +++ b/Prog/2026/RFK/README.md @@ -0,0 +1,36 @@ +# RFK Stadium and campus residential impact analysis +Author: Katie Visalli +Date: 7/15/26 + +Main Output for this work is in this [Powerpoint in Box](https://urbanorg.app.box.com/file/2330661878315). All charts are linked to an excel tab. There are multiple excels sorted into subfolders of the [results box folder](https://urbanorg.app.box.com/folder/395142829696) + +## Identify Analysis Area +*This step should be run first.* +The [code script in R](1.Identify RFK Adjacent Tracts.RMD) uses DC shapefiles to find the DC Square that is the RFK statdium and tracts within a mile of it. +The script generates maps. If changed, they should also be uploaded to [the Geography & ACS Results box folder](https://urbanorg.app.box.com/folder/395144629978) +Most importantly, it makes dcdata\Libraries\Requests\Prog\2026\RFK\Result\rfk_tracts.csv which later scripts read to identify the RFK analysis area and East and West of the river. + +## ACS Summary stats +The script [ACS summary stats.sas](ACS summary stats.sas) outputs large tables with demographic summary stats by geography (DC, Ward 7, RFK analysis Area, RFK-East, and RFK-West). +Copy-Paste the output to the tab Total Summary Stats in the [ACS Summary Stats V2 Box Excel](https://urbanorg.app.box.com/file/2276965492622). +The rest of the tabs in the sheet will automatically update, as well as the powerpoint figures which are linked to that excel. + +## Subsidized Housing +First run [Step 1](Subsidized Housing Step 1.sas) in SAS to get data to send to R in [Step 2](Subsidized Housing Step 2.Rmd) +Creates tables for subsidy types. Copy-paste changed results to [the Box Excel](https://urbanorg.app.box.com/file/2311253231300) and maps of subsidized housing in the [Subsidized Housing Folder](https://urbanorg.app.box.com/folder/395143302579) + +## Parcel Data +[Ownershp Property Data.sas](Ownershp Property Data.sas) uses parcel data, rent control and geography data and produces results for: +1.Property Type +2.Owner Type +3.Homestead Exemptions +4.Rent Control +5.Length of Ownership +Copy/paste output to [property_ownership_result.xlsx](https://urbanorg.app.box.com/file/2311252974930) + +## Sales +[Property Data.sas](Property Data.sas) uses residential sales and geography data to create time series for median sale price and sale volume for single-family and condos +copy/paste output to [Property Records Results.xlsx](https://urbanorg.app.box.com/file/2306604045202) + +## Displacement Risk +[Displacement Risk.Rmd](Property Records Results.xlsx) uses [Yipeng's Displacement risk data](https://urbanorg.app.box.com/file/1855335661929?s=azizabexnna8hwhjshcnpaj0uvye2197) to create [maps and tables](https://urbanorg.app.box.com/file/2316524451867) Will need to copy/paste for tables if changed. diff --git a/Prog/2026/RFK/Subsidized Housing Step 1.sas b/Prog/2026/RFK/Subsidized Housing Step 1.sas new file mode 100644 index 0000000..88e7907 --- /dev/null +++ b/Prog/2026/RFK/Subsidized Housing Step 1.sas @@ -0,0 +1,280 @@ +/* +Katie Visalli +6/25/26 + +Adapt the program PresCat\Prog\Project_assisted_units.sas to create summaries of assisted housing projects and units for the RFK analysis geographies. + +The program PresCat\Prog\Project_assisted_units.sas currently generates tables that have unique counts of assisted housing projects and units, +by different assistance categories, by Ward, ANC, and neighborhood cluster (and age of building). +The goal will be to adapt this program to create the counts we need for the RFK analysis geographies. + +Copy the program to the Requests repo. +Within the data Project_assisted_units; data step, add code to create any new geographies needed for summarization. +The source data includes the standard DC geographies, including Ward2022 and Geo2020 (census tract). + +After this data step, the program creates tables with a series of Proc Tabulate procedures. +These simply summarize the data in different ways. +Instead of doing this, you will probably want to just export the Project_assisted_units data set to something you can ingest in R. (Using Proc Export, for instance.) + +When summarizing these data a few things to be aware of. +Use mid_asst_units as the count of assisted housing units. +Each row in the file represents on assisted housing project. +Use the ProgCat variable to create breakdowns by subsidy categories. These were created to be mutually exclusive with these values. +1 = 'Public housing' +2 = 'Section 8 only' +9 = 'Section 8 and other subsidies' +8 = 'LIHTC w/tax exempt bonds' +3 = 'LIHTC w/o tax exempt bonds' +7 = 'HUD-insured mortgage only' +4,5 = 'HOME/CDBG only' +6 = 'DC HPTF only' +10 = 'Section 202/811 only' +20, 30 = 'Other subsidies/combinations'; +Since the file also has the latitude/longitude and x/y coordinates, we can also map these projects. Using different symbols or colors by ProgCat would helpful. + +*/ + + +/************************************************************************** + Program: Project_assisted_units.sas + Library: PresCat + Project: NeighborhoodInfo DC + Author: P. Tatian + Created: 10/15/14 + Version: SAS 9.2 + Environment: Local Windows session (desktop) + + Description: Summarize assisted units by project. + Program based on NLIHC\Prog\Assisted_units.sas, which was used for + the 2011 DC Housing Monitor analysis. + + Modifications: +**************************************************************************/ + +%include "\\sas1\DCdata\SAS\Inc\StdRemote.sas"; + +** Define libraries **; +%DCData_lib( PresCat ) +%DCData_lib( RealProp ) + +%let PUBHSNG = 1; +%let S8PROG = 2; +%let LIHTC = 3; +%let HOME = 4; +%let CDBG = 5; +%let HPTF = 6; +%let TEBOND = 7; +%let HUDMORT = 8; +%let S202811 = 9; +%let OTHER = 10; +%let MAXPROGS = 10; + +proc format; + value ProgCat (notsorted) + 1 = 'Public housing' + 2 = 'Section 8 only' + 9 = 'Section 8 and other subsidies' + 8 = 'LIHTC w/tax exempt bonds' + 3 = 'LIHTC w/o tax exempt bonds' + 7 = 'HUD-insured mortgage only' + 4,5 = 'HOME/CDBG only' + 6 = 'DC HPTF only' + 10 = 'Section 202/811 only' + 20, 30 = 'Other subsidies/combinations'; + value ward + 1 = 'Ward 1' + 2 = 'Ward 2' + 3 = 'Ward 3' + 4 = 'Ward 4' + 5 = 'Ward 5' + 6 = 'Ward 6' + 7 = 'Ward 7' + 8 = 'Ward 8'; + +%Data_to_format( + FmtLib=work, + FmtName=$nlihcid2cat, + Desc=, + Data=PresCat.Project_category, + Value=nlihc_id, + Label=category_code, + OtherLabel='', + DefaultLen=1, + Print=N, + Contents=N + ) + +** Aggregate subsidies so one record per portfolio **; + +proc summary data=PresCat.Subsidy (where=(Subsidy_Active and Portfolio~='PRAC')) nway; + class nlihc_id portfolio; + var Units_assist Poa_start Poa_end Compl_end; + output out=Subsidy_unique + sum(Units_assist)= min(Poa_start Poa_end Compl_end)=; +run; + +** Combine project and subsidy data **; + +data Project_subsidy; + + merge + Prescat.Project_category_view + (in=inProject) + Subsidy_unique + (in=inSubsidy); + by NLIHC_ID; + + if inProject and inSubsidy; + +run; + +data Project_assisted_units; + + set Project_subsidy; + by NLIHC_ID; + + retain num_progs total_units min_asst_units max_asst_units asst_units1-asst_units&MAXPROGS + poa_start_min poa_end_min poa_end_max compl_end_min compl_end_max proj_ayb_min proj_lat proj_lon; + + array a_aunits{&MAXPROGS} asst_units1-asst_units&MAXPROGS; + + if first.NLIHC_ID then do; + + total_units = .; + num_progs = 0; + + min_asst_units = .; + mid_asst_units = .; + max_asst_units = .; + + poa_start = .; + poa_end_min = .; + poa_end_max = .; + + compl_end_min = .; + compl_end_max = .; + + proj_ayb_min = .; + + do i = 1 to &MAXPROGS; + a_aunits{i} = 0; + end; + + end; + + num_progs + 1; + + total_units = max( total_units, Proj_Units_Tot, Units_Assist ); + + select ( portfolio ); + when ( 'PUBHSNG' ) a_aunits{&PUBHSNG} = sum( Units_Assist, a_aunits{&PUBHSNG} ); + when ( 'PB8' ) a_aunits{&S8PROG} = sum( Units_Assist, a_aunits{&S8PROG} ); + when ( 'LIHTC' ) a_aunits{&LIHTC} = sum( Units_Assist, a_aunits{&LIHTC} ); + when ( 'HOME' ) a_aunits{&HOME} = sum( Units_Assist, a_aunits{&HOME} ); + when ( 'CDBG' ) a_aunits{&CDBG} = sum( Units_Assist, a_aunits{&CDBG} ); + when ( 'DC HPTF' ) a_aunits{&HPTF} = sum( Units_Assist, a_aunits{&HPTF} ); + when ( 'TEBOND' ) a_aunits{&TEBOND} = sum( Units_Assist, a_aunits{&TEBOND} ); + when ( 'HUDMORT' ) a_aunits{&HUDMORT} = sum( Units_Assist, a_aunits{&HUDMORT} ); + when ( '202/811' ) a_aunits{&S202811} = sum( Units_Assist, a_aunits{&S202811} ); + otherwise a_aunits{&OTHER} = sum( Units_Assist, a_aunits{&OTHER} ); + end; + + min_asst_units = max( Units_Assist, min_asst_units ); + + poa_start_min = min( poa_start, poa_start_min ); + + if poa_end > 0 then do; + poa_end_min = min( poa_end, poa_end_min ); + poa_end_max = max( poa_end, poa_end_max ); + end; + + compl_end_min = min( compl_end, compl_end_min ); + compl_end_max = max( compl_end, compl_end_max ); + + if proj_ayb > 0 then proj_ayb_min = min( proj_ayb, proj_ayb_min ); + + if last.NLIHC_ID then do; + + do i = 1 to &MAXPROGS; + a_aunits{i} = min( a_aunits{i}, total_units ); + end; + + max_asst_units = min( sum( of asst_units1-asst_units&MAXPROGS ), total_units ); + + mid_asst_units = min( round( mean( min_asst_units, max_asst_units ), 1 ), max_asst_units ); + + if mid_asst_units ~= max_asst_units then err_asst_units = max_asst_units - mid_asst_units; + + ** Reporting categories **; + + if num_progs = 1 then do; + + if a_aunits{&PUBHSNG} > 0 then ProgCat = 1; + else if a_aunits{&S8PROG} > 0 then ProgCat = 2; + else if a_aunits{&LIHTC} > 0 then ProgCat = 3; + else if a_aunits{&HOME} > 0 then ProgCat = 4; + else if a_aunits{&CDBG} > 0 then ProgCat = 5; + else if a_aunits{&HPTF} > 0 then ProgCat = 6; + else if a_aunits{&HUDMORT} > 0 then ProgCat = 7; + else if a_aunits{&S202811} > 0 then ProgCat = 10; + else if a_aunits{&TEBOND} > 0 or a_aunits{&OTHER} > 0 then ProgCat = 20; + + end; + else do; + + if a_aunits{&S8PROG} > 0 then ProgCat = 9; + else if a_aunits{&LIHTC} > 0 and a_aunits{&TEBOND} > 0 then ProgCat = 8; + else if a_aunits{&LIHTC} > 0 then ProgCat = 3; + else ProgCat = 30; + + end; + + if min_asst_units > 0 then output; + + end; + + format poa_start_min poa_end_min poa_end_max compl_end_min compl_end_max mmddyy10.; + + drop i portfolio Units_Assist poa_start poa_end compl_end proj_ayb _freq_ _type_; + +run; + +*export to .csv to put in R; +proc export data=project_assisted_units + outfile='\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Data\assisted_living_units.xlsx' + dbms=xlsx + replace; +run; + + +/* Get Duplicated counts of projects for total project numbers */ + +** pivot the subsidy types from long to wide format, +for one observation per project and multiple variables for Subsidy Types **; +proc transpose data = Subsidy_unique out= subsidy_wide prefix= subtype_; + by NLIHC_ID; + id Portfolio; + var Units_Assist; +run; + +*merge subsidies with project data; + +data Project_subsidy_wide; + + merge + Prescat.Project_category_view + (in=inProject) + Subsidy_wide + (in=inSubsidy); + by NLIHC_ID; + + if inProject and inSubsidy; + +run; + +*export to .csv to put in R; +proc export data=Project_subsidy_wide + outfile='\\sas1\dcdata\Libraries\Requests\Prog\2026\RFK\Data\assisted_living_wide.xlsx' + dbms=xlsx + replace; +run; diff --git a/Prog/2026/RFK/Subsidized Housing Step 2.Rmd b/Prog/2026/RFK/Subsidized Housing Step 2.Rmd new file mode 100644 index 0000000..416388a --- /dev/null +++ b/Prog/2026/RFK/Subsidized Housing Step 2.Rmd @@ -0,0 +1,483 @@ +--- +title: "Subsidized Housing step 2" +author: "Katie Visalli" +date: "2026-06-25" +output: html_document +--- +Read in the subsidized housing data from SAS and process + +```{r set up} +library(tidyverse) +library(tidylog) +library(readxl) +library(sf) +library(ggplot2) +library(urbnthemes) +library(urbnmapr) +set_urbn_defaults(style = "map") +library(openxlsx) + +#colorschemes +blues <- c("#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635") +greys <- c("#f5f5f5", "#D2D2D2","#9D9D9D","#696969","#353535", "#000000") +yellows <- c("#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215") +pinks <- c("#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123") +greens <- c("#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19") +reds <- c("#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A") +``` + +```{r load data} +#Read in the subsidized housing data from SAS and process +subsidized_housing_data <- read_xlsx("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/assisted_living_units.xlsx") + +#version of subsidized data with duplicated units allowed - prioritizing looking at all subsidy types +subsidized_housing_wide <- read_xlsx("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/assisted_living_wide.xlsx") + +#RFK areas +rfk_tracts <- read.csv("//Sas1/dcdata/Libraries/Requests/Prog/2026/RFK/result/rfk_tracts.csv") + +``` + +```{r load shapefiles} +tract_shape <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Census_Tracts_in_2020/Census_Tracts_in_2020.shp") + +ward_shape <- st_read("//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Data/Ward_-_2022/Ward_-_2022.shp") + +#re-attach geometry to RFK tracts +rfk_shape <- tract_shape %>% + mutate(GEOID=as.numeric(GEOID)) %>% + select(GEOID) %>% + left_join(rfk_tracts, by = "GEOID") + +#shape file with only RFK area +rfk_only_shape <- rfk_shape %>% + filter(rfk_group == 1) + +#confirm CRS of census tract date +st_crs(ward_shape)$epsg + +#convert XY coordinates for subsidized units to geometry +subsidized_housing_sf <- subsidized_housing_data %>% + filter(!is.na(Proj_x) & !is.na(Proj_y)) %>% + st_as_sf(coords = c("Proj_lon", "Proj_lat"), crs = "EPSG:4326") + +#same with wide data +subsidized_housing_wide_sf <- subsidized_housing_wide %>% + filter(!is.na(Proj_x) & !is.na(Proj_y)) %>% + st_as_sf(coords = c("Proj_lon", "Proj_lat"), crs = "EPSG:4326") + +st_crs(subsidized_housing_sf)$epsg + +#transform crs to match +subsidized_housing_sf <- st_transform(subsidized_housing_sf, crs = st_crs(ward_shape)) %>% + #label categorical combined subsidy type variable (from SAS format) + mutate(ProgCatName = case_when(ProgCat == 1 ~ 'Public housing', + ProgCat == 2 ~ 'Section 8 only', + ProgCat == 9 ~ 'Section 8 and other subsidies', + ProgCat == 8 ~ 'LIHTC w/tax exempt bonds', + ProgCat == 3 ~ 'LIHTC w/o tax exempt bonds', + #ProgCat == 7 ~ 'HUD-insured mortgage only', + ProgCat %in% c(4,5) ~ 'HOME/CDBG only', + ProgCat == 6 ~ 'DC HPTF only', + ProgCat == 10 ~ 'Section 202/811 only', + ProgCat %in% c(7, 20, 30) ~ 'Other subsidies/combinations')) +#align wide data's crs +subsidized_housing_wide_sf <- st_transform(subsidized_housing_wide_sf, crs = st_crs(ward_shape)) + +#Use geometry to match subsidized housing points to census tracts +subsidized_rfk_shape <- st_join(subsidized_housing_sf, rfk_shape, .predicate = st_within) %>% + mutate(ward7 = if_else(Ward2022 == "7", 1, 0)) + + +#Use geometry to match subsidized housing points to census tracts +subsidized_wide_rfk_shape <- st_join(subsidized_housing_wide_sf, rfk_shape, .predicate = st_within) %>% + mutate(ward7 = if_else(Ward2022 == "7", 1, 0)) +``` + +```{r map test} +#test geographies by plotting subsidized housing X Y coords and census tracts +test_map <- ggplot() + + #RFK tracts + geom_sf(data = rfk_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_sf, aes(geometry = geometry), colour = "red") +test_map + +``` +```{r tables - Unduplicated} + + +wb <- createWorkbook() + +#Number and type of Units by area +#RFK groups +tab_units_rfk <- subsidized_rfk_shape %>% + group_by(ProgCatName) %>% + summarise(DC = sum(mid_asst_units, na.rm = T), + Ward7 = sum(ward7 * mid_asst_units, na.rm = T), + RFK = sum(rfk_group * mid_asst_units, na.rm = T), + East = sum(east_of_anacostia * mid_asst_units, na.rm = T), + West = sum(west_of_anacostia * mid_asst_units, na.rm = T)) %>% + st_drop_geometry() + +addWorksheet(wb, "units_rfk") +writeData(wb, "units_rfk", tab_units_rfk) + + +tab_units_rfk_error <- subsidized_rfk_shape %>% + group_by(ProgCatName) %>% + summarise(DC_error = sum(err_asst_units, na.rm = T), + Ward7_error = sum(ward7 * err_asst_units, na.rm = T), + RFK_error = sum(rfk_group * err_asst_units, na.rm = T), + East_error = sum(east_of_anacostia * err_asst_units, na.rm = T), + West_error = sum(west_of_anacostia * err_asst_units, na.rm = T)) %>% + st_drop_geometry() + + +writeData(wb, "units_rfk", tab_units_rfk_error, startRow = nrow(tab_units_rfk) + 3) + +#Number and type of Buildings by area +tab_buildings_rfk <- subsidized_rfk_shape %>% + group_by(ProgCatName) %>% + summarise(DC = sum(Bldg_count, na.rm = T), + Ward7 = sum(ward7 * Bldg_count, na.rm = T), + RFK = sum(rfk_group * Bldg_count, na.rm = T), + East = sum(east_of_anacostia * Bldg_count, na.rm = T), + West = sum(west_of_anacostia * Bldg_count, na.rm = T)) %>% + st_drop_geometry() + +addWorksheet(wb, "buildings_rfk") +writeData(wb, "buildings_rfk", tab_buildings_rfk) + +#Number and type of Projects by area +tab_projects_rfk <- subsidized_rfk_shape %>% + group_by(ProgCatName) %>% + summarise(DC = n(), + Ward7 = sum(ward7, na.rm = T), + RFK = sum(rfk_group, na.rm = T), + East = sum(east_of_anacostia, na.rm = T), + West = sum(west_of_anacostia, na.rm = T)) %>% + st_drop_geometry() + +addWorksheet(wb, "projects_rfk") +writeData(wb, "projects_rfk", tab_projects_rfk) + + +``` +```{r tables - All subsidy types} +#tables for all subsidy types - by geography, them combine geographies into table +allsub_dc <- subsidized_wide_rfk_shape %>% + mutate(place = "DC") %>% + group_by(place) %>% + summarise(across(starts_with("subtype_"), ~ sum(.x, na.rm = T))) + +allsub_rfk <- subsidized_wide_rfk_shape %>% + filter(rfk_group == 1) %>% + mutate(place = "RFK") %>% + group_by(place) %>% + summarise(across(starts_with("subtype_"), ~ sum(.x, na.rm = T))) + +allsub_subg <- subsidized_wide_rfk_shape %>% + filter(!is.na(rfk_sub_group)) %>% + mutate(place = rfk_sub_group) %>% + group_by(place) %>% + summarise(across(starts_with("subtype_"), ~ sum(.x, na.rm = T))) + +allsub_w7 <- subsidized_wide_rfk_shape %>% + filter(ward7 == 1) %>% + mutate(place = "Ward 7") %>% + group_by(place) %>% + summarise(across(starts_with("subtype_"), ~ sum(.x, na.rm = T))) + +all_subsidy_types <- rbind(allsub_dc, allsub_rfk, allsub_subg, allsub_w7) %>% + st_drop_geometry() + +addWorksheet(wb, "all_subsidy_types") +writeData(wb, "all_subsidy_types", all_subsidy_types) +``` + +```{r export tables} +saveWorkbook(wb, "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidized results v2.xlsx", overwrite = T) +``` + +```{r coords of zoomed in area} + +# Filter to Ward 7 +ward7 <- ward_shape %>% + filter(WARD_ID == "7") + +ward6 <- ward_shape %>% + filter(WARD_ID == "6") + +#Find ward 7 coordinates, for zooming in on area +ward7coords = as.data.frame(unique(st_coordinates(ward7))) + + +#find x where y is max in ward 6 for x minnimum +ward6coords = as.data.frame(unique(st_coordinates(ward6))) %>% + filter(Y == max(Y)) + + +#minimmum of Y +ymin = min(ward7coords$Y) +ymax = max(ward7coords$Y) +xmin = ward6coords$X +xmax = max(ward7coords$X) + + +``` + + +```{r maps - Unduplicated} +#show subsidized units +proj_type_map <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_sf, aes(geometry = geometry, size = Proj_Units_Tot, color = ProgCatName), alpha = 0.5) + + scale_color_manual(values = c(blues[5], reds[5], pinks[2], pinks[2], greys[6], yellows[5], yellows[8], greens[5], greens[5]), name = "Subsidy Type") + + scale_fill_manual(values = c(greys[2], greys[3]), name = "RFK Adjacent Area") + + scale_size(name = "Number of Subsidized Units") +proj_type_map + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/proj_type_map.png", + plot = proj_type_map, + device = "png", + width = 6.5, + dpi = 1000) + +#show subsidized units ZOOMED IN +proj_type_map_zoom <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_sf %>% filter(ProgCatName != "Section 202/811 only"), aes(geometry = geometry, size = Proj_Units_Tot, color = ProgCatName), alpha = 0.5) + + scale_color_manual(values = c(blues[5], reds[5], pinks[2], pinks[2], greys[6], yellows[5], greens[5], greens[5]), name = "Subsidy Type") + + scale_fill_manual(values = c(greys[2], greys[3]), name = "RFK Adjacent Area") + + scale_size(name = "Number of Subsidized Units") + + #Zoom in + coord_sf( + xlim = c(xmin, xmax), + ylim = c(ymin, ymax), + expand = FALSE) +proj_type_map_zoom + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/proj_type_map_zoom.png", + plot = proj_type_map_zoom, + device = "png", + width = 6.5, + dpi = 1000) + +#simplified version +proj_type_map2 <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_sf, aes(geometry = geometry, color = ProgCatName)) + + scale_color_manual(values = c(blues[5], reds[5], pinks[2], pinks[2], greys[6], yellows[5], yellows[8], greens[5], greens[5]), name = "Subsidy Type") + + scale_fill_manual(values = c(greys[2], greys[3]), name = "RFK Adjacent Area") +proj_type_map2 + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/proj_type_map2.png", + plot = proj_type_map2, + device = "png", + width = 6.5, + dpi = 1000) + +#Simplified version - ZOOMED IN +proj_type_map2_zoom <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_sf %>% filter(ProgCatName != "Section 202/811 only"), aes(geometry = geometry, color = ProgCatName)) + + scale_color_manual(values = c(blues[5], reds[5], pinks[2], pinks[2], greys[6], yellows[5], greens[5], greens[5]), name = "Subsidy Type") + + scale_fill_manual(values = c(greys[2], greys[3]), name = "RFK Adjacent Area") + + #Zoom in + coord_sf( + xlim = c(xmin, xmax), + ylim = c(ymin, ymax), + expand = FALSE) +proj_type_map2_zoom + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/proj_type_map2_zoom.png", + plot = proj_type_map2_zoom, + device = "png", + width = 6.5, + dpi = 1000) +``` + +```{r maps - Duplicated} +#LIHTC Map +LIHTC_DC <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_LIHTC)), aes(geometry = geometry), color = pinks[5]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Subsidized Projects with LIHTC") +LIHTC_DC + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/LIHTC_DC.png", + plot = LIHTC_DC, + device = "png", + width = 6.5, + dpi = 1000) + +#LIHTC Map, zoomed in +LIHTC_rfk <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_LIHTC)), aes(geometry = geometry), color = pinks[5]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Subsidized Projects with LIHTC") + + #Zoom in + coord_sf( + xlim = c(xmin, xmax), + ylim = c(ymin, ymax), + expand = FALSE) +LIHTC_rfk + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/LIHTC_rfk.png", + plot = LIHTC_rfk, + device = "png", + width = 6.5, + dpi = 1000) + +#HPTF Map +HPTF_DC <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_DC_housing_production_tr)), aes(geometry = geometry), color = blues[5]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Subsidized Projects with DC HPTF") +HPTF_DC + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/HPTF_DC.png", + plot = HPTF_DC, + device = "png", + width = 6.5, + dpi = 1000) + +#HPTF Map, zoomed in +HPTF_rfk <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_DC_housing_production_tr)), aes(geometry = geometry), color = blues[5]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Subsidized Projects with DC HPTF") + + #Zoom in + coord_sf( + xlim = c(xmin, xmax), + ylim = c(ymin, ymax), + expand = FALSE) +HPTF_rfk + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/HPTF_rfk.png", + plot = HPTF_rfk, + device = "png", + width = 6.5, + dpi = 1000) + +#sec8 Map +sec8_DC <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_Project_based_section_8)), aes(geometry = geometry), color = greens[5]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Subsidized Projects with DC sec8") +sec8_DC + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/sec8_DC.png", + plot = sec8_DC, + device = "png", + width = 6.5, + dpi = 1000) + +#sec8 Map, zoomed in +sec8_rfk <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_Project_based_section_8)), aes(geometry = geometry), color = greens[5]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Subsidized Projects with DC sec8") + + #Zoom in + coord_sf( + xlim = c(xmin, xmax), + ylim = c(ymin, ymax), + expand = FALSE) +sec8_rfk + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/sec8_rfk.png", + plot = sec8_rfk, + device = "png", + width = 6.5, + dpi = 1000) + + +#Public Housing Map +pubH_DC <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_Public_housing)), aes(geometry = geometry), color = yellows[8]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Public Housing Projects") +pubH_DC + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/pubH_DC.png", + plot = pubH_DC, + device = "png", + width = 6.5, + dpi = 1000) + +#Public Housing Map, zoomed in +pubH_rfk <- ggplot() + + #RFK tracts + geom_sf(data = rfk_only_shape, aes(geometry = geometry, fill = rfk_sub_group), colour = "black") + +#ward outline + geom_sf(data = ward_shape, aes(geometry = geometry), fill = NA, colour = "black") + + #subsidized units + geom_sf(data = subsidized_housing_wide_sf %>% filter(!is.na(subtype_Public_housing)), aes(geometry = geometry), color = yellows[8]) + + scale_fill_manual(values = c(pinks[1], yellows[1]), name = "RFK Adjacent Area") + + ggtitle("Public Housing Projects") + + #Zoom in + coord_sf( + xlim = c(xmin, xmax), + ylim = c(ymin, ymax), + expand = FALSE) +pubH_rfk + +ggsave(filename = "//sas1/dcdata/Libraries/Requests/Prog/2026/RFK/Result/subsidy maps/pubH_rfk.png", + plot = pubH_rfk, + device = "png", + width = 6.5, + dpi = 1000) +``` +