Overview

Although Davidson County had the largest current population with 715,388 residents, data showed that Williamson and Rutherford counties had faster growth during the analyzed period. When growth was measured per 100 residents, Davidson County ranked fifth among the counties in the Nashville Metropolitan Statistical Area, behind Williamson, Rutherford, Wilson, and Maury counties. In terms of total population growth, Davidson County added the most residents, increasing by 117,204 residents; Rutherford County came in second with an increase of 68,221 residents, while Williamson County ranked third with an addition of 52,109 residents.

The table below is organized by percentage change, and the data were sorted by the change per 100 residents. Specifically, Williamson County grew the fastest at approximately 25%, Rutherford County grew by 23%, and Davidson County grew about 20%.

Population Data with Percent Change
County CurrentPop EarlierPop Region Change Percent_change
Williamson 260351 208242 Doughnut 52109 0.2502
Rutherford 360646 292425 Doughnut 68221 0.2333
Wilson 158805 129918 Doughnut 28887 0.2223
Maury 107791 88738 Non-doughnut 19053 0.2147
Davidson 715388 598184 Davidson 117204 0.1959
Trousdale 11957 10131 Non-doughnut 1826 0.1802
Sumner 204424 174773 Doughnut 29651 0.1697
Macon 26240 23261 Non-doughnut 2979 0.1281
Robertson 75539 67517 Doughnut 8022 0.1188
Dickson 55983 51608 Non-doughnut 4375 0.0848
Cheatham 41829 39087 Doughnut 2742 0.0702
Cannon 14818 13958 Non-doughnut 860 0.0616
Smith 20389 19389 Non-doughnut 1000 0.0516
Hickman 25436 24561 Non-doughnut 875 0.0356

Code:

Here is the R Code that produced the analysis, which relied on data from the U.S. Census Bureau’s American Community Survey.

# ============================================================
# Step 1: Install and load required packages
# ============================================================
required_packages <- c(
  "tidyverse",
  "knitr",
  "kableExtra"
)

for (pkg in required_packages) {
  if (!requireNamespace(pkg, quietly = TRUE)) {
    install.packages(pkg)
  }
}

library(tidyverse)
library(knitr)
library(kableExtra)

# ============================================================
# Step 2: Create a vector containing the 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 counts
# ============================================================
CurrentPop <- c(
  14818, 41829, 715388, 55983, 25436, 26240,
  107791, 75539, 360646, 20389, 204424, 11957,
  260351, 158805
)

# ============================================================
# Step 4: Create a vector containing earlier population counts
# ============================================================
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 the vectors into a population data frame
# ============================================================
Population <- data.frame(
  County,
  CurrentPop,
  EarlierPop,
  Region
)

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

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

# ============================================================
# Step 9: Display the updated and sorted population data frame
# ============================================================
Population

# ============================================================
# Step 10: Create a data frame containing only County and Change
# ============================================================
Change_only <- Population %>%
  select(County, Change)

# ============================================================
# Step 11: Sort the Change_only data frame by Change descending
# ============================================================
Change_only <- Change_only %>%
  arrange(desc(Change))

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

# ============================================================
# Step 13: Create a Doughnut data frame containing only
#         Davidson and Doughnut-region counties
# ============================================================
Doughnut <- Population %>%
  filter(Region %in% c("Davidson", "Doughnut"))

# ============================================================
# Step 14: Sort the Doughnut data frame by Change descending
# ============================================================
Doughnut <- Doughnut %>%
  arrange(desc(Change))

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

# ============================================================
# Step 16: Create a Summary data frame containing totals by
#         Region
# ============================================================
Summary <- Population %>%
  group_by(Region) %>%
  summarise(
    TotalCurrentPop = sum(CurrentPop),
    TotalEarlierPop = sum(EarlierPop),
    TotalChange = sum(Change),
    .groups = "drop"
  )

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

# ============================================================
# Step 18: Create a copy of the Population data frame
# ============================================================
Population_v2 <- Population

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

# ============================================================
# Step 20: Sort the data frame by Percent_change descending
# ============================================================
Population_v2 <- Population_v2 %>%
  arrange(desc(Percent_change))

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

# ============================================================
# Step 22: Create a formatted table for Population
# ============================================================
Population_tbl <- Population %>%
  kbl(
    caption = "Population Data",
    digits = 4
  ) %>%
  kable_styling(
    bootstrap_options = c(
      "striped",
      "hover",
      "condensed"
    ),
    full_width = FALSE
  )

# ============================================================
# Step 23: Display the Population formatted table
# ============================================================
Population_tbl

# ============================================================
# Step 24: Create a formatted table for Change_only
# ============================================================
Change_only_tbl <- Change_only %>%
  kbl(
    caption = "County Population Change",
    digits = 4
  ) %>%
  kable_styling(
    bootstrap_options = c(
      "striped",
      "hover",
      "condensed"
    ),
    full_width = FALSE
  )

# ============================================================
# Step 25: Display the Change_only formatted table
# ============================================================
Change_only_tbl

# ============================================================
# Step 26: Create a formatted table for Doughnut
# ============================================================
Doughnut_tbl <- Doughnut %>%
  kbl(
    caption = "Davidson and Doughnut Counties",
    digits = 4
  ) %>%
  kable_styling(
    bootstrap_options = c(
      "striped",
      "hover",
      "condensed"
    ),
    full_width = FALSE
  )

# ============================================================
# Step 27: Display the Doughnut formatted table
# ============================================================
Doughnut_tbl

# ============================================================
# Step 28: Create a formatted table for Summary
# ============================================================
Summary_tbl <- Summary %>%
  kbl(
    caption = "Regional Population Summary",
    digits = 4
  ) %>%
  kable_styling(
    bootstrap_options = c(
      "striped",
      "hover",
      "condensed"
    ),
    full_width = FALSE
  )

# ============================================================
# Step 29: Display the Summary formatted table
# ============================================================
Summary_tbl

# ============================================================
# Step 30: Create a formatted table for Population_v2
# ============================================================
Population_v2_tbl <- Population_v2 %>%
  kbl(
    caption = "Population Data with Percent Change",
    digits = 4
  ) %>%
  kable_styling(
    bootstrap_options = c(
      "striped",
      "hover",
      "condensed"
    ),
    full_width = FALSE
  )

# ============================================================
# Step 31: Display the Population_v2 formatted table
# ============================================================
Population_v2_tbl