This map displays the fair market rent (FMR) for three-bedroom units across different ZIP codes in Rutherford County. The color scheme visually differentiates rental prices, making it easy to compare costs across the area.

Code:

r, echo=FALSE, message=FALSE, warning=FALSE # Load required packages if (!require(“tidyverse”)) install.packages(“tidyverse”) if (!require(“gtExtras”)) install.packages(“gtExtras”) if (!require(“leafpop”)) install.packages(“leafpop”) if (!require(“sf”)) install.packages(“sf”) if (!require(“mapview”)) install.packages(“mapview”) if (!require(“RColorBrewer”)) install.packages(“RColorBrewer”)

library(tidyverse) library(gtExtras) library(sf) library(mapview) library(leafpop) library(RColorBrewer)

Load rent data

FMR_RuCo <- read_csv(“https://raw.githubusercontent.com/drkblake/Data/refs/heads/main/FMR_RuCo.csv”)

Load ZIP code shapefile

download.file(“https://www2.census.gov/geo/tiger/GENZ2020/shp/cb_2020_us_zcta520_500k.zip”, “ZCTAs2020.zip”) unzip(“ZCTAs2020.zip”) ZCTAMap <- read_sf(“cb_2020_us_zcta520_500k.shp”)

Convert ZIP to character

FMR_RuCo\(ZIP <- as.character(FMR_RuCo\)ZIP)

Join rent data with spatial data

FMR_RuCo_Map <- left_join(FMR_RuCo, ZCTAMap, by = c(“ZIP” = “ZCTA5CE20”)) %>% select(-c(AFFGEOID20, GEOID20, NAME20, LSAD20, ALAND20, AWATER20)) %>% st_as_sf()

Generate map

ZIP_Map <- mapview( FMR_RuCo_Map, zcol = “BR3”, layer.name = “Three-Bedroom Rent”, col.regions = brewer.pal(9, “Reds”), popup = popupTable( FMR_RuCo_Map, feature.id = FALSE, row.numbers = FALSE, zcol = c(“ZIP”, “BR3”) ) )

ZIP_Map