Creating Distance-Based Buffers Around Transplant Centers
This section generates geographic buffers around transplant centers at predefined distances (e.g., 50, 100, 200 miles).
Four buffer objects are created:
Transplant_center_all_buffer
Transplant_centers_active_buffer
Transplant_centers_HIV_buffer
Transplant_centers_HOPE_buffer
Each object is organized hierarchically by:
Organ type
Distance
Year (when applicable)
This nested structure allows consistent iteration across organs, time points, and buffer distances in later analyses.
Step 1: Initialize Empty Buffer Lists
Empty lists are created to store buffered sf objects.
These will hold polygon geometries representing the catchment area around each transplant center.
Step 2: Loop Over Organs and Distances
For each organ in organ_list
and each distance in distance_list:
Only distances expressed in miles are processed in this block.
Mile distances are converted to meters, since the spatial data are projected in EPSG:5070 (which uses meters).
Distance conversions:
50 miles → 80,467.2 meters
100 miles → 160,934.4 meters
200 miles → 321,868 meters
Step 3: Create Buffers for All Centers
For each organ and distance:
st_buffer() generates circular buffer polygons around each center.
The result represents the geographic area within the specified radius of the center.
These are stored as:
Transplant_center_all_buffer[[organ]][[distance]]
Step 4: Create Year-Specific Buffers
Within each organ–distance combination, the code then loops over year_list and generates buffers for:
Active transplant centers
HIV R+ transplant centers
HOPE (HIV D+/R+) transplant centers
Each of these is buffered using the same distance in meters to ensure comparability.
---title: "Center-level geographic calculations"format: html---::: {.Rcode title="Source code"}The full R script is available at:- [`R/geographical_computations_for_centers.R`](https://github.com/VagishHemmige/HOPE-CDC-analysis-2026/blob/master/R/geographical_computations_for_centers.R)This R script file is itself reliant on the following helper files:- [`R/setup.R`](https://github.com/VagishHemmige/HOPE-CDC-analysis-2026/blob/master/R/setup.R)- [`R/functions.R`](https://github.com/VagishHemmige/HOPE-CDC-analysis-2026/blob/master/R/functions.R):::## Creating Distance-Based Buffers Around Transplant CentersThis section generates geographic buffers around transplant centers at predefined distances (e.g., 50, 100, 200 miles).Four buffer objects are created:- `Transplant_center_all_buffer`- `Transplant_centers_active_buffer`- `Transplant_centers_HIV_buffer`- `Transplant_centers_HOPE_buffer`Each object is organized hierarchically by:1. **Organ type**2. **Distance**3. **Year** (when applicable)This nested structure allows consistent iteration across organs, time points, and buffer distances in later analyses.---### Step 1: Initialize Empty Buffer ListsEmpty lists are created to store buffered `sf` objects. These will hold polygon geometries representing the catchment area around each transplant center.---### Step 2: Loop Over Organs and DistancesFor each `organ` in `organ_list`and each `distance` in `distance_list`:- Only distances expressed in miles are processed in this block.- Mile distances are converted to **meters**, since the spatial data are projected in EPSG:5070 (which uses meters).Distance conversions:- 50 miles → 80,467.2 meters - 100 miles → 160,934.4 meters - 200 miles → 321,868 meters ---### Step 3: Create Buffers for All CentersFor each organ and distance:- `st_buffer()` generates circular buffer polygons around each center.- The result represents the geographic area within the specified radius of the center.These are stored as:`Transplant_center_all_buffer[[organ]][[distance]]`---### Step 4: Create Year-Specific BuffersWithin each organ–distance combination, the code then loops over `year_list` and generates buffers for:- Active transplant centers - HIV R+ transplant centers - HOPE (HIV D+/R+) transplant centers Each of these is buffered using the same distance in meters to ensure comparability.The resulting structure is:- `Transplant_centers_active_buffer[[organ]][[distance]][[year]]`- `Transplant_centers_HIV_buffer[[organ]][[distance]][[year]]`- `Transplant_centers_HOPE_buffer[[organ]][[distance]][[year]]`---### Why This Structure MattersThis approach ensures:- Consistent geometry projection (EPSG:5070)- Identical buffer distances across center categories- A clean, iterable nested structure for downstream population overlays- Straightforward generation of paired comparisons (e.g., 2017 vs 2022)These buffered polygons are later intersected with census tract–level HIV population estimates to quantify geographic access to transplant programs.```{r, eval=FALSE}# Create buffer objects for transplant centers based on distanceTransplant_center_all_buffer<-list()Transplant_centers_active_buffer<-list()Transplant_centers_HIV_buffer<-list()Transplant_centers_HOPE_buffer<-list()for (organ_loop in organ_list){ for (distance_loop in distance_list){ if (str_detect(distance_loop, "mile")) { distance<-case_when( distance_loop=="50mile" ~ 80467.2, distance_loop=="100mile" ~ 160934.4, distance_loop=="200mile" ~ 321868 ) Transplant_center_all_buffer[[organ_loop]][[distance_loop]]<-st_buffer(Transplant_centers_all_sf [[organ_loop]],dist = distance) for (year_loop in year_list) { Transplant_centers_active_buffer[[organ_loop]][[distance_loop]][[year_loop]]<- st_buffer(Transplant_centers_active_SF[[organ_loop]][[year_loop]], dist = distance) Transplant_centers_HIV_buffer[[organ_loop]][[distance_loop]][[year_loop]]<- st_buffer(Transplant_centers_HIV_sf[[organ_loop]][[year_loop]], dist = distance) Transplant_centers_HOPE_buffer[[organ_loop]][[distance_loop]][[year_loop]]<- st_buffer(Transplant_centers_HOPE_sf[[organ_loop]][[year_loop]], dist = distance) } } }}```## Other portions of the analysis- [**Setup**](setup.qmd): Defines global paths, data sources, cohort inclusion criteria, and analysis-wide constants.- [**Functions**](functions.qmd): Reusable helper functions for cohort construction, matching, costing, and modeling.- [**Tables**](tables.qmd): Summary tables and regression outputs generated from the final models.- [**Figures**](figures.qmd):Visualizations of costs, risks, and model-based estimates.- [**About**](about.qmd): methods, assumptions, and disclosures