Introduction

This report documents US Census data pertaining to the percentage of the population which are senior citizens (age 85 and older) residing within Erie County, New York.

Data Preparation

Load Packages

The following R packages were used to obtain, tidy, organize, and plot the US Census data.

library(tidycensus) #used to obtain US Census data
library(here) #used for easy referencing 
library(tidyverse) #used to tidy data
library(ggplot2) #used to plot data
library(tigris) #use features to help with acquisition and display of spatial ACS data
library(sf) #used to representing spatial data
library(mapview) # load interactive viewing of spatial data in R
library(viridisLite) #add custom labels to Mapview

Obtaining and Preparing Data

To focus on only data pertinent to answering questions about the percentage of senior citizens within Erie County, New York, specific data was downloaded and read in from US Census, American Community Survey (ACS) Demographic and Housing Estimate data. Prior to obtaining the data, the specific variables needed to be identified; using load_variables was used to review the variables aviable and the associate variable names.

vars <- load_variables(2021, "acs5")
view(vars)

vars_profiles21 <- load_variables(2021, "acs5/profile")
view(vars_profiles21)

Using get_acs() from tidycensus, the percentage of the population which was 85 years and older (DP05_0017P) was downloaded for the Erie County, New York (for the period of from 2017 through 2021) and read into R.

erie_over_85 <- get_acs(
  geography = "tract",
  variables = c(
    Over_85 = "DP05_0017P"
  ),
  state = "NY",
  county = "Erie",
  geometry = TRUE
)
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |=======                                                               |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==============                                                        |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |===================                                                   |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=====================                                                 |  31%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  79%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |===========================================================           |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |===============================================================       |  89%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |======================================================================|  99%
  |                                                                            
  |======================================================================| 100%

Maps

Map View

Below is an interactive map depicting the approximate locations of senior citizens (based on the percentage of the population which is over 85 years old), within Erie County, New York.

sf_use_s2(FALSE)

mapview(erie_over_85, zcol = "estimate", #interactive Map
        layer.name = "%_85+_YO_'17-'21_ACS") #Name Layer

Map Count Data (Graduated symbol map)

Below is another map depicting the approximate locations of senior citizens, within Erie County, New York. To better depict the number of 85+ residents, this map is displayed in proportional symbols.

centroids <- st_centroid(erie_over_85)

ggplot() + 
  geom_sf(data = erie_over_85, color = "black", fill = "white") + 
  geom_sf(data = centroids, aes(size = estimate), #size consistent with underlying data
          alpha = 0.7, color = "navy") + 
  theme_void() +  #remove previous theme
  labs(title = "Senior Citizen population by Census tract",
       subtitle = "2017-2021 ACS, Erie County, New York",
       size = "ACS Estimate") + 
  scale_size_area(max_size = 6) #plot proportional symbols