Load our environment

Packages

Functions

Data Sets KPIs are organized in the following themes:

Population

Economics

Affordability

Housing

Summary Tables by Dimension

In this section we create our Summary Tables for selected KPIs. This will give us an overview of our KPIs by different dimensions

We should check the calculations for Wages per Capita - they seem high

select_summary_kpis(region_summary, stat = "mean")
select_summary_kpis(division_summary, stat = "mean")

CBSA Overview

Overview of Selected GEOIDs

This section contains a standard table of our selected CBSA with the Core KPIs

kpi_core %>%
  filter(GEOID %in% params$selected_geoids) %>%
  select(GEOID, name, all_of(kpi_vars))  %>%
  kable(caption = "Selected CBSA KPI Summary")
Selected CBSA KPI Summary
GEOID name pop_total eco_wage_per_capita eco_wage_growth_5yr eco_unemployment_rate afford_home_value afford_gross_rent afford_rent_growth_5yr afford_rental_index housing_vacancy_rate housing_permits_per_1000
23540 Gainesville, FL Metro Area 344521 119000.3 0.0900778 3.775 245800 1219 0.2791186 1.208901 0.1095177 30.033

Comparisons

In this section we have comparisons of the Core KPIs from our selected CBSA to the averages of our key dimensions

compare_cbsa_to_summary(
  cbsa_geoid = params$selected_geoids,
  kpi_data = kpi_core,
  summary_data = state_summary,
  dimension = "primary_state",
  metrics = kpi_vars
) 
compare_cbsa_to_summary(
  cbsa_geoid = params$selected_geoids,
  kpi_data = kpi_core,
  summary_data = region_summary,
  dimension = "region",
  metrics = kpi_vars
) 
compare_cbsa_to_summary(
  cbsa_geoid = params$selected_geoids,
  kpi_data = kpi_core,
  summary_data = division_summary,
  dimension = "division",
  metrics = kpi_vars
) 

Comparison Rankings

In this section we create the rankings of our Core KPIs by main Dimensions

# Create our selected KPI Ranks
select_kpi_ranks <- kpi_ranks %>%
  filter(GEOID %in% params$selected_geoids,
         group == "region") %>%
  mutate(group_kpi = paste(group, kpi, sep = "_")) %>%
  select(GEOID, name, group_kpi, rank) %>%
  pivot_wider(
    names_from = group_kpi,
    values_from = rank,
    names_glue = "{group_kpi}_rank"
  ) %>%
  mutate(region = dimensions$region)

# Join to our Counts and print
counts_region %>%
  filter(region == dimensions$region) %>%
  left_join(select_kpi_ranks, by = c("region" = "region"))

KPI Distributions

In this section we review the distributions of some of our Core KPIs and highlight our relevant GEOID

Our CBSA is on the lower end of the affordability index, meaning that rents are high relative to income

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_kpi_facets(., 
                "region", 
                c("afford_rental_index"),
                highlight_geoid = params$selected_geoids
                )
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

The Price Index is high in the region, meaning it is relatively expensive

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_kpi_facets(., 
                "region", 
                c("afford_rpp"),
                highlight_geoid = params$selected_geoids
                )
## Warning: Removed 16 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

Home Values are around the average for values in the region

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_kpi_facets(., 
                "region", 
                c("afford_home_value"),
                highlight_geoid = params$selected_geoids
                )

The Unemployment Rate is more stable than in other CBSAs in the region

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_kpi_facets(., 
                "region", 
                c("eco_unemployment_stability"),
                highlight_geoid = params$selected_geoids
                )

The industry make up is less diversified than other regions

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_kpi_facets(., 
                "region", 
                c("eco_industry_entropy"),
                highlight_geoid = params$selected_geoids
                )
## Warning: Removed 8 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

Rents are higher than average

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_kpi_facets(., 
                "region", 
                c("afford_gross_rent"),
                highlight_geoid = params$selected_geoids
                )

plot_kpi_violin_facets(kpi_core, 
                "region", 
                c("afford_gross_rent"),
                highlight_geoid = params$selected_geoids
                )

KPI Relationships

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_scatter_kpi_pairs(., 
                       xvar = "eco_wage_per_capita", 
                       yvar = "afford_rental_index", 
                       group_var = "region", 
                       highlight_geoid = params$selected_geoids)
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_point()`).

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_scatter_kpi_pairs(., 
                       xvar = "eco_wage_growth_5yr", 
                       yvar = "pop_growth_5yr", 
                       group_var = "region", 
                       highlight_geoid = params$selected_geoids)
## Warning: Removed 17 rows containing missing values or values outside the scale range
## (`geom_point()`).

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_scatter_kpi_pairs(., 
                       xvar = "housing_vacancy_rate", 
                       yvar = "afford_rent_growth_5yr", 
                       group_var = "region", 
                       highlight_geoid = params$selected_geoids)
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_scatter_kpi_pairs(., 
                       xvar = "pop_education_rate", 
                       yvar = "eco_unemployment_rate", 
                       group_var = "region", 
                       highlight_geoid = params$selected_geoids)

kpi_core %>%
  filter(cbsa_type == dimensions$cbsa_type) %>%
plot_scatter_kpi_pairs(., 
                       xvar = "housing_permits_per_1000", 
                       yvar = "housing_hpi_growth_5yr", 
                       group_var = "region", 
                       highlight_geoid = params$selected_geoids)
## Warning: Removed 27 rows containing missing values or values outside the scale range
## (`geom_point()`).

(We might want to revisit this function, creating a facet instead of a grouping)

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.