Skip to contents

Retrieve Addresses of all RHCs in Georgia

rhcs <- providers(state = "GA", 
                  specialty_code = "00-17") |> 
  pull(npi) |> 
  map_dfr(\(x) nppes(npi = x)) |> 
  select(organization, 
         address:zip) |> 
  mutate(address = paste0(address, " ", city, ", ", state),
         city = NULL,
         state = NULL) |> 
  distinct()
rhcs
#> # A tibble: 83 × 3
#>    organization                                  address                   zip  
#>    <chr>                                         <chr>                     <chr>
#>  1 TMC HARALSON FAMILY HEALTHCARE CENTER         204 ALLEN MEMORIAL DR SU… 30110
#>  2 TMC TALLAPOOSA FAMILY HEALTHCARE CENTER       25 W LYON ST TALLAPOOSA,… 30176
#>  3 HIAWASSEE FAMILY PRACTICE P C                 56 HOSPITAL ST HIAWASSEE… 30546
#>  4 TMC WEST CARROLL FAMILY HEALTHCARE CENTER INC 1125 E HIGHWAY 166 BOWDO… 30108
#>  5 BACON COUNTY HEALTH SERVICES, INC             204 E 15TH ST ALMA, GA    31510
#>  6 BOWDON- MT. ZION PRIMARY HEALTH CENTER ,INC.  41 WELLINGTON MILL RD WH… 30185
#>  7 HOSPITAL AUTHORITY OF MITCHELL COUNTY         25 PERRY ST CAMILLA, GA   31730
#>  8 THE MEDICAL CENTER OF ELBERTON, LLP           109 COLLEGE AVE ELBERTON… 30635
#>  9 UNION COUNTY HOSPITAL AUTHORITY               162 HOSPITAL RD STE A BL… 30512
#> 10 HOSPITAL AUTHORITY OF MITCHELL COUNTY         259 US HIGHWAY 19 NORTH … 31730
#> # ℹ 73 more rows


Geocode with {tidygeocoder}

mapbox <- geocode(rhcs,
                  address = address,
                  method = 'mapbox', 
                  full_results = TRUE) |> 
  select(organization:long)


Retrieve Georgia counties shapefile from {tigris}

sf_cnt <- counties(state = "GA", 
                   year = 2022, 
                   progress_bar = FALSE) |> 
          ms_simplify()

sf_cnt$mid <- st_centroid(sf_cnt$geometry)


Map with {ggplot}

ggplot(sf_cnt) + 
  geom_sf(fill = "skyblue", 
          colour = "white", 
          alpha = 0.5) +
  geom_sf_text(aes(geometry = mid, 
                   label = NAME),
               size = 3.5,
               check_overlap = TRUE) +
  geom_jitter(data = mapbox,
             mapping = aes(long, lat), 
             fill = "yellow", 
             color = "darkred", 
             alpha = 0.75, 
             size = 4.5, 
             shape = 21,
             stroke = 1.5) +
  theme_void()