library(tidyverse)
library(readxl) # read excel files
path <- "/home/ajackson/Dropbox/Rprojects/Curated_Data_Files/ZipPop/"
knitr::opts_chunk$set(echo = TRUE)Texas Pop by Zip
Zipcodes
Texas
Texas Population by Zipcode, 2022
Read in Pop by zip from excel file
Downloaded excel file from https://www.texas-demographics.com/zip_codes_by_population which has pop figures for 2022.
Read in and check excel file
df <- read_excel(paste0(path, "Texas_DemographicsByZipCode_sample.xlsx"),
skip=6, col_names=FALSE, .name_repair="minimal") %>%
select(Zip=1, Pop=6)
# saveRDS(df, paste0(path, "Zipcode_Pop_2022.rds"))Show the data
Let’s look at the data around Houston
df %>%
filter(stringr::str_detect(Zip, "^7700")) %>%
gt::gt() %>%
gt::fmt_number(
columns=2,
decimals=0
)| Zip | Pop |
|---|---|
| 77002 | 18,800 |
| 77003 | 10,169 |
| 77004 | 35,506 |
| 77005 | 28,470 |
| 77006 | 24,006 |
| 77007 | 42,881 |
| 77008 | 38,496 |
| 77009 | 36,872 |