There is no question that Davidson County has grown rapidly over the past five years. However, according to the latest Census data, it is not the fastest growing county in the Nashville-Metropolitan Statistical Area. In fact, it is only the 5th highest county in terms of growth per 100 residents in the area despite having the highest number of new residents in that time period. The top three growing counties in the last five years are Williamson, Rutherford, and Wilson, which all border Davidson County. Compared to Davidson County’s growth rate of about 20 percent, doughnut counties have an average growth rate of around 17 percent, whereas non-doughnut counties have an average growth rate of around 9 percent.

Below is a table that represents the data for each county from the U.S. Census Bureau’s American Community Survey. It is sorted by the change in growth per 100 residents, starting with Williamson County at a 25 percent growth.

##        County CurrentPop EarlierPop       Region Change Percent_change
## 1  Williamson     260351     208242     Doughnut  52109     0.25023290
## 2  Rutherford     360646     292425     Doughnut  68221     0.23329401
## 3      Wilson     158805     129918     Doughnut  28887     0.22234794
## 4       Maury     107791      88738 Non-doughnut  19053     0.21471072
## 5    Davidson     715388     598184     Davidson 117204     0.19593302
## 6   Trousdale      11957      10131 Non-doughnut   1826     0.18023887
## 7      Sumner     204424     174773     Doughnut  29651     0.16965435
## 8       Macon      26240      23261 Non-doughnut   2979     0.12806844
## 9   Robertson      75539      67517     Doughnut   8022     0.11881452
## 10    Dickson      55983      51608 Non-doughnut   4375     0.08477368
## 11   Cheatham      41829      39087     Doughnut   2742     0.07015120
## 12     Cannon      14818      13958 Non-doughnut    860     0.06161341
## 13      Smith      20389      19389 Non-doughnut   1000     0.05157564
## 14    Hickman      25436      24561 Non-doughnut    875     0.03562559

Code:

Below is the R code used to produce the analysis.

# ============================================================
# Step 1: Install and load required packages
# ============================================================
if (!require("tidyverse")) {
  install.packages("tidyverse")
}
library(tidyverse)

if (!require("knitr")) {
  install.packages("knitr")
}
library(knitr)

if (!require("kableExtra")) {
  install.packages("kableExtra")
}
library(kableExtra)

# ============================================================
# Step 2: Create a vector containing county names
# ============================================================
County <- c("Cannon", "Cheatham", "Davidson", "Dickson", "Hickman", "Macon",
            "Maury", "Robertson", "Rutherford", "Smith", "Sumner", "Trousdale",
            "Williamson", "Wilson")

# ============================================================
# Step 3: Create a vector containing current population values
# ============================================================
CurrentPop <- c(14818, 41829, 715388, 55983, 25436, 26240, 107791, 75539,
                360646, 20389, 204424, 11957, 260351, 158805)

# ============================================================
# Step 4: Create a vector containing earlier population values
# ============================================================
EarlierPop <- c(13958, 39087, 598184, 51608, 24561, 23261, 88738, 67517,
                292425, 19389, 174773, 10131, 208242, 129918)

# ============================================================
# Step 5: Create a vector identifying each county's region
# ============================================================
Region <- c("Non-doughnut", "Doughnut", "Davidson", "Non-doughnut",
            "Non-doughnut", "Non-doughnut", "Non-doughnut", "Doughnut",
            "Doughnut", "Non-doughnut", "Doughnut", "Non-doughnut",
            "Doughnut", "Doughnut")

# ============================================================
# Step 6: Combine vectors into a Population data frame
# ============================================================
Population <- data.frame(
  County,
  CurrentPop,
  EarlierPop,
  Region
)

# ============================================================
# Step 7: Display the Population data frame
# ============================================================
Population

# ============================================================
# Step 8: Sort the Population data frame by CurrentPop
#         in descending order
# ============================================================
Population <- Population %>%
  arrange(desc(CurrentPop))

# ============================================================
# Step 9: Display the sorted Population data frame
# ============================================================
Population

# ============================================================
# Step 10: Add a Change variable showing population growth
#          (CurrentPop minus EarlierPop)
# ============================================================
Population <- Population %>%
  mutate(Change = CurrentPop - EarlierPop)

# ============================================================
# Step 11: Display the updated data frame with Change
# ============================================================
Population

# ============================================================
# Step 12: Create a Change_only data frame containing
#          County and Change, sorted by Change descending
# ============================================================
Change_only <- Population %>%
  select(County, Change) %>%
  arrange(desc(Change))

# ============================================================
# Step 13: Display the Change_only data frame
# ============================================================
Change_only

# ============================================================
# Step 14: Create a Doughnut data frame containing only
#          Davidson and Doughnut region counties, sorted
#          by Change descending
# ============================================================
Doughnut <- Population %>%
  filter(Region %in% c("Davidson", "Doughnut")) %>%
  arrange(desc(Change))

# ============================================================
# Step 15: Display the Doughnut data frame
# ============================================================
Doughnut

# ============================================================
# Step 16: Create a Summary data frame that totals
#          CurrentPop, EarlierPop, and Change by Region
# ============================================================
Summary <- Population %>%
  group_by(Region) %>%
  summarize(
    CurrentPop = sum(CurrentPop),
    EarlierPop = sum(EarlierPop),
    Change = sum(Change)
  )

# ============================================================
# Step 17: Display the Summary data frame
# ============================================================
Summary

# ============================================================
# Step 18: Copy the Population data frame to Population_v2
# ============================================================
Population_v2 <- Population

# ============================================================
# Step 19: Add a Percent_change variable to Population_v2
#          (Change divided by EarlierPop)
# ============================================================
Population_v2 <- Population_v2 %>%
  mutate(Percent_change = Change / EarlierPop)

# ============================================================
# Step 20: Sort Population_v2 by Percent_change
#          in descending order
# ============================================================
Population_v2 <- Population_v2 %>%
  arrange(desc(Percent_change))

# ============================================================
# Step 21: Display the Population_v2 data frame
# ============================================================
Population_v2

# ============================================================
# Step 22: Create and display a formatted table for
#          the Population data frame
# ============================================================
Population_tbl <- Population %>%
  kbl(caption = "Population Data") %>%
  kable_styling(full_width = FALSE)

Population_tbl

# ============================================================
# Step 23: Create and display a formatted table for
#          the Change_only data frame
# ============================================================
Change_only_tbl <- Change_only %>%
  kbl(caption = "Population Change by County") %>%
  kable_styling(full_width = FALSE)

Change_only_tbl

# ============================================================
# Step 24: Create and display a formatted table for
#          the Doughnut data frame
# ============================================================
Doughnut_tbl <- Doughnut %>%
  kbl(caption = "Davidson and Doughnut Counties") %>%
  kable_styling(full_width = FALSE)

Doughnut_tbl

# ============================================================
# Step 25: Create and display a formatted table for
#          the Summary data frame
# ============================================================
Summary_tbl <- Summary %>%
  kbl(caption = "Regional Population Summary") %>%
  kable_styling(full_width = FALSE)

Summary_tbl

# ============================================================
# Step 26: Create and display a formatted table for
#          the Population_v2 data frame
# ============================================================
Population_v2_tbl <- Population_v2 %>%
  kbl(caption = "Population Growth Rates") %>%
  kable_styling(full_width = FALSE)

Population_v2_tbl