The data shown in this report come from the U.S. Census Bureau’s American Community Survey. The purpose of this report is to examine population changes among Nashville-area counties and compare their population growth between the two years represented in the data.
| County | CurrentPop | EarlierPop | Region | Change | Percent_change |
|---|---|---|---|---|---|
| Macon | 24264 | 14773 | Donut | 9491 | 0.64 |
| Smith | 23689 | 15809 | Non-donut | 7880 | 0.50 |
| Cheatham | 45928 | 33737 | Non-donut | 12191 | 0.36 |
| Sumner | 174733 | 145973 | Donut | 28760 | 0.20 |
| Wilson | 120025 | 107729 | Donut | 12296 | 0.11 |
| Hickman | 25436 | 23181 | Non-donut | 2255 | 0.10 |
| Williamson | 251317 | 230927 | Donut | 20390 | 0.09 |
| Trousdale | 13587 | 12511 | Donut | 1076 | 0.09 |
| Dickson | 53689 | 49908 | Non-donut | 3781 | 0.08 |
| Cannon | 16118 | 15518 | Non-donut | 600 | 0.04 |
| Maury | 115054 | 110889 | Donut | 4165 | 0.04 |
| Davidson | 713588 | 691584 | Donut | 22004 | 0.03 |
| Robertson | 224420 | 217921 | Donut | 6499 | 0.03 |
| Rutherford | 160086 | 160225 | Donut | -139 | 0.00 |
The table shows population changes among Nashville-area counties, ranked from the largest percentage increase to the smallest. The counties at the top of the table experienced the greatest percentage growth between the two years represented in the American Community Survey data. This shows that population growth has not been evenly distributed throughout the Nashville area, with some counties experiencing substantially greater growth than others.
The following section contains the complete R script used to wrangle the population data and produce the final table.
# Load required packages
if (!require("tidyverse", quietly = TRUE)) {
install.packages("tidyverse")
}
if (!require("kableExtra", quietly = TRUE)) {
install.packages("kableExtra")
}
library(tidyverse)
library(kableExtra)
# Create the County variable
County <- c(
"Williamson", "Rutherford", "Wilson", "Maury",
"Davidson", "Trousdale", "Sumner", "Macon",
"Robertson", "Dickson", "Cheatham", "Cannon",
"Smith", "Hickman"
)
# Create the CurrentPop variable
CurrentPop <- c(
251317, 160086, 120025, 115054,
713588, 13587, 174733, 24264,
224420, 53689, 45928, 16118,
23689, 25436
)
# Create the EarlierPop variable
EarlierPop <- c(
230927, 160225, 107729, 110889,
691584, 12511, 145973, 14773,
217921, 49908, 33737, 15518,
15809, 23181
)
# Create the Region variable
Region <- c(
"Donut", "Donut", "Donut", "Donut",
"Donut", "Donut", "Donut", "Donut",
"Donut", "Non-donut", "Non-donut", "Non-donut",
"Non-donut", "Non-donut"
)
# Create the population data frame
Population <- data.frame(
County,
CurrentPop,
EarlierPop,
Region
)
# Sort by current population
Population <- Population %>%
arrange(desc(CurrentPop))
# Calculate population change
Population <- Population %>%
mutate(Change = CurrentPop - EarlierPop)
# Calculate percent change
Population <- Population %>%
mutate(Percent_change = Change / EarlierPop)
# Sort by percent change
Population <- Population %>%
arrange(desc(Percent_change))
# Create final kableExtra table
Population_table <- Population %>%
kbl(
caption = "Population Change in Nashville-Area Counties",
format = "html",
digits = 2
) %>%
kable_styling(
bootstrap_options = c("striped", "hover", "responsive"),
full_width = FALSE
)
Population_table