2025_ET_Poverty_Analysis

This data brief focuses on Poverty analysis of Texans as of current data in March 2025. The data shown to be cleaned here was published in this ArcGIS storymap. Data was mainly sourced from ACS 5-Year estimates from 2023, the latest data as of March 2025.

Some of the data was saved locally and other data was downloaded via tidycensus to make regional maps later on by county, region, and districts.

knitr::opts_chunk$set(echo = TRUE)
library(ipumsr)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats   1.0.0     ✔ readr     2.1.5
✔ ggplot2   3.5.2     ✔ stringr   1.5.1
✔ lubridate 1.9.4     ✔ tibble    3.2.1
✔ purrr     1.0.4     ✔ tidyr     1.3.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
library(janitor)

Attaching package: 'janitor'

The following objects are masked from 'package:stats':

    chisq.test, fisher.test
library(stringr)
library(ipumsr)
library(survey)
Loading required package: grid
Loading required package: Matrix

Attaching package: 'Matrix'

The following objects are masked from 'package:tidyr':

    expand, pack, unpack

Loading required package: survival

Attaching package: 'survey'

The following object is masked from 'package:graphics':

    dotchart
library(tidycensus)

#pulling from acs data with tidycensus 
acs23d <- load_variables(year=2023,dataset = "acs5") 

Loading Data

#downloaded local ACS data
income_quintiles_texas <- read.csv("raw_data/ACSDT1Y2023.B19081-2024-11-20T151736.csv") |>
  mutate(Label..Grouping. = sub(" ", "", Label..Grouping.))
poverty_sex_age <- read.csv("raw_data/ACSDT5Y2022.B17001-2024-11-20T174431.csv")
poverty_past12 <- read.csv("raw_data/ACSST5Y2022.S1701-2024-11-15T034529.csv")

#population estimates by county (from Texas Demographic Center) as well as County region classification from Texas Comptroller Office
regions <- read.csv("County_12_Regions.csv")
population_est_overall <- read.csv("2023_txpopest_county/2023_txpopest_county.csv")

#sourced from Texas Demographic Center 2023 population estimates (all ages and demographis groups)
population_asg <- read.csv("2023_txpopest_county/alldata.csv") 

#location data for mapping 
location_fips <- read.csv("county_location_state.csv")

Due to some unconventional and lack of universal naming across datasets, this function was made to help normalize and “fix” names to fit the correct spelling of the counties in Texas.

fix_names <- function(name) {
  if (name == "Dewitt") return("DeWitt")
  if (name == "Mcculloch") return("McCulloch")
  if (name == "Mclennan") return("McLennan")
  if (name == "Mcmullen") return("McMullen")
  if (name == "Elpaso") return("El Paso")
  if (name == "Sanaugustine") return("San Augustine")
  if (name == "Sansaba") return("San Saba")
  if (name == "Sanjacinto") return("San Jacinto")
  if (name == "Sanpatricio") return("San Patricio")
  if (name == "Fortbend") return("Fort Bend")
  if (name == "Deafsmith") return("Deaf Smith")
  if (name == "Palopinto") return("Palo Pinto")
  if (name == "Jimhogg") return("Jim Hogg")
  if (name == "Jimwells") return("Jim Wells")
  if (name == "Lasalle") return("La Salle")
  if (name == "Valverde") return("Val Verde")
  if (name == "Redriver") return("Red River")
  if (name == "Vanzandt") return("Van Zandt")
  if (name == "Jeffdavis") return("Jeff Davis")
  if (name == "Tomgreen") return("Tom Green")
  if (name == "Liveoak") return("Live Oak")
  if (name == "De Witt") return("DeWitt")
  

  return(name)
}

Cleaning population groups for the state to use in aggregation and percentage calculations later on.

child_population <- population_asg |>
  filter(Age%in% c("< 1 Year", "1 Years", "2 Years", "3 Years", "4 Years", "5 Years", "6 Years", "7 Years", "8 Years", "9 Years", "10 Years", "11 Years", "12 Years", "13 Years", "14 Years", "15 Years", "16 Years", "17 Years")) |>
  filter(County != "STATE OF TEXAS") |>
  mutate(County = sapply(str_to_title(sub(" COUNTY", "", County)), fix_names)) |>
  group_by(County) |>
  summarise(total_pop = sum(Total))

total_population <- population_asg |>
  filter(County != "STATE OF TEXAS") |>
  mutate(County = sapply(str_to_title(sub(" COUNTY", "", County)), fix_names)) |>
  group_by(County) |>
  summarise(total_pop = sum(Total))

region_children_pop <- left_join(child_population, regions, by = "County") |>
  group_by(Region) |>
  summarise(child_region_pop = sum(total_pop))


head(child_population)
# A tibble: 6 × 2
  County    total_pop
  <chr>         <int>
1 Anderson      10725
2 Andrews        5739
3 Angelina      21879
4 Aransas        4393
5 Archer         1993
6 Armstrong       392
head(total_population)
# A tibble: 6 × 2
  County    total_pop
  <chr>         <int>
1 Anderson     115002
2 Andrews       37324
3 Angelina     174060
4 Aransas       50016
5 Archer        18192
6 Armstrong      3634
write.csv(file = "child_population_23.csv", child_population, row.names = FALSE)
write.csv(file = "total_population_23.csv", total_population, row.names = FALSE)

Cleaning data for socioeconomic indicators

clean_psaa <- poverty_sex_age |>
  select(Label..Grouping., contains("Estimate")) |>
  mutate(Label..Grouping. = str_trim(Label..Grouping., side = "left"))


children_poverty <- clean_psaa |>
  filter(Label..Grouping. %in% c("Under 5 years", "5 years", "6 to 11 years", 
                                 "12 to 14 years", "15 years", "16 and 17 years"))

children_below_poverty_line <- children_poverty |>
  slice(1:12) |>
  mutate(Label..Grouping. = if_else(row_number() <= 6, paste0("male ", Label..Grouping.), paste0("female ", Label..Grouping.)))

head(children_below_poverty_line)
      Label..Grouping. Texas..Estimate Anderson.County..Texas..Estimate
1   male Under 5 years         203,250                              460
2         male 5 years          41,359                               54
3   male 6 to 11 years         249,367                              506
4  male 12 to 14 years         116,185                              169
5        male 15 years          38,980                              155
6 male 16 and 17 years          71,186                              154
  Andrews.County..Texas..Estimate Angelina.County..Texas..Estimate
1                              46                              557
2                               0                               11
3                             230                            1,018
4                              33                              576
5                               0                              172
6                              31                              226
  Aransas.County..Texas..Estimate Archer.County..Texas..Estimate
1                             187                             81
2                               0                             15
3                             398                             78
4                              67                             22
5                             112                              0
6                              36                             71
  Armstrong.County..Texas..Estimate Atascosa.County..Texas..Estimate
1                                 8                              374
2                                 0                               39
3                                 7                              275
4                                 0                              297
5                                 0                               14
6                                 6                              170
  Austin.County..Texas..Estimate Bailey.County..Texas..Estimate
1                            256                             99
2                              7                              0
3                            145                             73
4                             98                             72
5                             21                             28
6                             15                              3
  Bandera.County..Texas..Estimate Bastrop.County..Texas..Estimate
1                              73                             851
2                               0                             118
3                             154                             968
4                              41                             778
5                               0                             191
6                               9                             154
  Baylor.County..Texas..Estimate Bee.County..Texas..Estimate
1                             18                         255
2                              0                         102
3                             17                         279
4                              0                          34
5                              0                          27
6                             19                          71
  Bell.County..Texas..Estimate Bexar.County..Texas..Estimate
1                        3,187                        15,910
2                          712                         2,650
3                        3,781                        20,270
4                        1,637                         8,368
5                          627                         2,663
6                          910                         5,298
  Blanco.County..Texas..Estimate Borden.County..Texas..Estimate
1                             67                              0
2                              0                              0
3                             21                              0
4                             24                              0
5                              0                              0
6                              0                              0
  Bosque.County..Texas..Estimate Bowie.County..Texas..Estimate
1                             45                           709
2                              5                            96
3                            144                           983
4                            100                           310
5                             10                           177
6                              9                           200
  Brazoria.County..Texas..Estimate Brazos.County..Texas..Estimate
1                              729                          1,541
2                              246                            309
3                            1,417                          1,492
4                              696                            848
5                              167                            354
6                              797                            393
  Brewster.County..Texas..Estimate Briscoe.County..Texas..Estimate
1                               43                               4
2                                0                               0
3                              107                               0
4                                0                               5
5                                0                               0
6                                2                               0
  Brooks.County..Texas..Estimate Brown.County..Texas..Estimate
1                              0                           251
2                             77                             5
3                            187                           261
4                              0                           123
5                              0                            22
6                             24                            58
  Burleson.County..Texas..Estimate Burnet.County..Texas..Estimate
1                               15                             55
2                               45                             10
3                              100                            185
4                               37                            149
5                                0                             92
6                               44                              0
  Caldwell.County..Texas..Estimate Calhoun.County..Texas..Estimate
1                              382                             112
2                               30                               0
3                              216                              54
4                              130                              57
5                                0                               0
6                              337                              13
  Callahan.County..Texas..Estimate Cameron.County..Texas..Estimate
1                               83                           5,500
2                                0                           1,131
3                               26                           8,270
4                                7                           3,754
5                                0                           1,144
6                               39                           3,057
  Camp.County..Texas..Estimate Carson.County..Texas..Estimate
1                          228                             25
2                            0                              0
3                          152                             49
4                           59                              7
5                            0                              0
6                            7                             15
  Cass.County..Texas..Estimate Castro.County..Texas..Estimate
1                          269                             97
2                           95                              0
3                          374                            110
4                          130                              0
5                           64                              0
6                          100                              7
  Chambers.County..Texas..Estimate Cherokee.County..Texas..Estimate
1                              392                              534
2                                0                               73
3                              489                              438
4                              207                              281
5                              117                               70
6                               29                              104
  Childress.County..Texas..Estimate Clay.County..Texas..Estimate
1                               116                           23
2                                 0                            0
3                                 0                           29
4                                 0                            0
5                                 0                           16
6                                10                            2
  Cochran.County..Texas..Estimate Coke.County..Texas..Estimate
1                              33                           18
2                               0                            0
3                              30                           30
4                              13                            5
5                              12                            4
6                              22                            3
  Coleman.County..Texas..Estimate Collin.County..Texas..Estimate
1                              90                          2,312
2                               0                            402
3                              61                          2,932
4                               9                          1,415
5                               0                            603
6                              13                          1,514
  Collingsworth.County..Texas..Estimate Colorado.County..Texas..Estimate
1                                    37                                9
2                                     0                                0
3                                    69                               37
4                                    24                               23
5                                     0                                0
6                                     2                               95
  Comal.County..Texas..Estimate Comanche.County..Texas..Estimate
1                           249                               79
2                            74                                0
3                           470                               68
4                           170                               60
5                             0                               17
6                            85                               39
  Concho.County..Texas..Estimate Cooke.County..Texas..Estimate
1                             27                           378
2                              0                             1
3                             92                           297
4                              0                           247
5                              0                            81
6                              0                           143
  Coryell.County..Texas..Estimate Cottle.County..Texas..Estimate
1                             449                             39
2                              91                              0
3                             494                              0
4                             209                             38
5                              32                              0
6                             121                             13
  Crane.County..Texas..Estimate Crockett.County..Texas..Estimate
1                             0                                0
2                             0                                0
3                             0                                0
4                             0                                0
5                             0                                0
6                             0                                0
  Crosby.County..Texas..Estimate Culberson.County..Texas..Estimate
1                             76                                 0
2                             13                                 0
3                             53                               154
4                             49                                 0
5                             22                                 0
6                             18                                 0
  Dallam.County..Texas..Estimate Dallas.County..Texas..Estimate
1                             69                         18,591
2                              0                          4,068
3                              0                         22,941
4                              3                         12,128
5                             10                          3,849
6                             27                          6,546
  Dawson.County..Texas..Estimate Deaf.Smith.County..Texas..Estimate
1                            154                                156
2                              1                                  0
3                            186                                122
4                            172                                161
5                              0                                 35
6                             39                                 59
  Delta.County..Texas..Estimate Denton.County..Texas..Estimate
1                            12                          2,756
2                             3                            671
3                            63                          2,659
4                             3                          1,502
5                             0                            738
6                             0                          1,005
  DeWitt.County..Texas..Estimate Dickens.County..Texas..Estimate
1                            208                               0
2                             45                               0
3                             81                               0
4                             12                               7
5                             19                               0
6                             18                               4
  Dimmit.County..Texas..Estimate Donley.County..Texas..Estimate
1                            398                              6
2                            120                              2
3                            113                             16
4                            145                              6
5                              2                              0
6                              1                              0
  Duval.County..Texas..Estimate Eastland.County..Texas..Estimate
1                           110                               54
2                            53                               24
3                            74                               53
4                            72                              107
5                            26                                9
6                            18                               45
  Ector.County..Texas..Estimate Edwards.County..Texas..Estimate
1                         1,829                               0
2                           434                               0
3                         1,819                              23
4                         1,080                               0
5                           285                              36
6                           315                               0
  Ellis.County..Texas..Estimate El.Paso.County..Texas..Estimate
1                         1,139                           7,739
2                           269                           1,514
3                         1,510                          11,235
4                           538                           4,817
5                           291                           1,992
6                           207                           3,521
  Erath.County..Texas..Estimate Falls.County..Texas..Estimate
1                           449                            30
2                            81                             0
3                           163                           231
4                            91                           117
5                            45                            39
6                            61                            65
  Fannin.County..Texas..Estimate Fayette.County..Texas..Estimate
1                            158                              74
2                              8                               9
3                            221                             205
4                             93                              28
5                             35                              10
6                             69                              39
  Fisher.County..Texas..Estimate Floyd.County..Texas..Estimate
1                             14                             7
2                              4                            16
3                             25                            24
4                             15                            21
5                              3                             0
6                              3                             0
  Foard.County..Texas..Estimate Fort.Bend.County..Texas..Estimate
1                             0                             2,713
2                             0                               503
3                             0                             3,278
4                             0                             1,517
5                             0                               659
6                             0                             1,136
  Franklin.County..Texas..Estimate Freestone.County..Texas..Estimate
1                               87                                95
2                               25                                61
3                               28                                76
4                               32                                14
5                                0                                16
6                               51                                22
  Frio.County..Texas..Estimate Gaines.County..Texas..Estimate
1                          242                            195
2                            0                             27
3                          224                            121
4                           78                             90
5                           17                              0
6                           47                             77
  Galveston.County..Texas..Estimate Garza.County..Texas..Estimate
1                             1,694                             0
2                               405                             0
3                             1,974                           133
4                             1,135                             0
5                               372                             0
6                               486                             0
  Gillespie.County..Texas..Estimate Glasscock.County..Texas..Estimate
1                               107                                 0
2                                 0                                 0
3                               159                                 0
4                                61                                 5
5                                19                                 0
6                                42                                 8
  Goliad.County..Texas..Estimate Gonzales.County..Texas..Estimate
1                              5                              190
2                              0                                0
3                              6                               76
4                             21                               39
5                              0                               32
6                              1                               80
  Gray.County..Texas..Estimate Grayson.County..Texas..Estimate
1                          251                             875
2                           15                             170
3                          243                             670
4                           94                             617
5                            5                             128
6                           60                             250
  Gregg.County..Texas..Estimate Grimes.County..Texas..Estimate
1                         1,183                            185
2                           177                              0
3                         1,356                            260
4                           435                            148
5                           144                             56
6                           320                             38
  Guadalupe.County..Texas..Estimate Hale.County..Texas..Estimate
1                               650                          316
2                               190                           92
3                               731                          285
4                               424                          210
5                               119                           38
6                               331                           15
  Hall.County..Texas..Estimate Hamilton.County..Texas..Estimate
1                           10                               83
2                           10                                0
3                           14                                0
4                           18                               44
5                            0                               11
6                           10                                0
  Hansford.County..Texas..Estimate Hardeman.County..Texas..Estimate
1                               46                                6
2                                6                                0
3                               13                               26
4                                0                                4
5                                0                                0
6                                0                                8
  Hardin.County..Texas..Estimate Harris.County..Texas..Estimate
1                            323                         40,616
2                              3                         10,066
3                            336                         49,626
4                            153                         21,880
5                             44                          7,987
6                            200                         13,366
  Harrison.County..Texas..Estimate Hartley.County..Texas..Estimate
1                              500                               0
2                               36                               0
3                              767                               6
4                              462                              52
5                              177                               0
6                              133                               0
  Haskell.County..Texas..Estimate Hays.County..Texas..Estimate
1                              39                        1,117
2                               0                           34
3                              15                        1,638
4                              10                          491
5                               4                          283
6                               0                          106
  Hemphill.County..Texas..Estimate Henderson.County..Texas..Estimate
1                               21                               618
2                                0                               136
3                               24                               498
4                               24                               828
5                                0                                95
6                                9                               244
  Hidalgo.County..Texas..Estimate Hill.County..Texas..Estimate
1                          13,971                          175
2                           3,029                           98
3                          18,478                          172
4                           9,018                          183
5                           2,923                           23
6                           5,471                           28
  Hockley.County..Texas..Estimate Hood.County..Texas..Estimate
1                             160                          291
2                              69                           22
3                              95                          166
4                              48                          151
5                              75                          130
6                               2                           11
  Hopkins.County..Texas..Estimate Houston.County..Texas..Estimate
1                             130                             214
2                              58                              56
3                             332                             109
4                             157                              35
5                              38                              27
6                              48                             102
  Howard.County..Texas..Estimate Hudspeth.County..Texas..Estimate
1                            182                                0
2                             22                                0
3                            205                               32
4                            125                               16
5                             43                                0
6                             76                               18
  Hunt.County..Texas..Estimate Hutchinson.County..Texas..Estimate
1                          415                                180
2                          203                                  0
3                          659                                110
4                          146                                 40
5                          102                                 25
6                           95                                100
  Irion.County..Texas..Estimate Jack.County..Texas..Estimate
1                             0                           89
2                             0                            0
3                             7                           55
4                             0                           52
5                             0                            0
6                             0                            0
  Jackson.County..Texas..Estimate Jasper.County..Texas..Estimate
1                             164                            416
2                               0                             54
3                              27                            276
4                              66                            235
5                               0                             81
6                              70                            172
  Jeff.Davis.County..Texas..Estimate Jefferson.County..Texas..Estimate
1                                  0                             2,450
2                                  0                               532
3                                  0                             3,127
4                                 80                             1,182
5                                 17                               414
6                                 18                               555
  Jim.Hogg.County..Texas..Estimate Jim.Wells.County..Texas..Estimate
1                              304                               283
2                                0                                53
3                               70                               707
4                               11                               398
5                               29                               119
6                                5                               225
  Johnson.County..Texas..Estimate Jones.County..Texas..Estimate
1                             711                            35
2                              83                            34
3                           1,315                            41
4                             493                            13
5                             216                             0
6                             480                            27
  Karnes.County..Texas..Estimate Kaufman.County..Texas..Estimate
1                            124                             393
2                             59                              69
3                             57                             705
4                              0                             558
5                             12                             162
6                             46                             326
  Kendall.County..Texas..Estimate Kenedy.County..Texas..Estimate
1                             115                              0
2                              64                              0
3                              82                              0
4                              56                              0
5                              20                              0
6                              48                              0
  Kent.County..Texas..Estimate Kerr.County..Texas..Estimate
1                            0                          313
2                            0                           38
3                            0                          215
4                            0                          147
5                            0                            8
6                            0                          172
  Kimble.County..Texas..Estimate King.County..Texas..Estimate
1                             15                            0
2                              0                            0
3                             20                            3
4                             14                            0
5                              7                            0
6                             13                            0
  Kinney.County..Texas..Estimate Kleberg.County..Texas..Estimate
1                             44                             439
2                              0                             206
3                              0                             377
4                              0                             306
5                            103                              18
6                              0                             259
  Knox.County..Texas..Estimate Lamar.County..Texas..Estimate
1                            5                           280
2                            0                           203
3                           24                           423
4                           22                           315
5                            0                            83
6                            0                           185
  Lamb.County..Texas..Estimate Lampasas.County..Texas..Estimate
1                           73                               61
2                           12                               10
3                          141                               46
4                           75                               11
5                           19                                0
6                           28                               15
  La.Salle.County..Texas..Estimate Lavaca.County..Texas..Estimate
1                                0                            208
2                                0                             38
3                               79                             92
4                               68                             38
5                               91                             16
6                               35                             56
  Lee.County..Texas..Estimate Leon.County..Texas..Estimate
1                          22                           96
2                           0                            0
3                          93                          144
4                          28                          123
5                           3                           27
6                          20                           61
  Liberty.County..Texas..Estimate Limestone.County..Texas..Estimate
1                             668                               138
2                             233                               123
3                           1,009                               195
4                             648                               183
5                              89                                74
6                             661                                81
  Lipscomb.County..Texas..Estimate Live.Oak.County..Texas..Estimate
1                               25                               66
2                                5                               14
3                               11                               44
4                                2                               15
5                                0                               10
6                               14                               51
  Llano.County..Texas..Estimate Loving.County..Texas..Estimate
1                            17                              0
2                             0                              0
3                           128                              0
4                            34                              0
5                            36                              0
6                             0                              0
  Lubbock.County..Texas..Estimate Lynn.County..Texas..Estimate
1                           2,347                           69
2                             353                           13
3                           2,304                           99
4                           1,014                            0
5                             369                           10
6                             649                            4
  McCulloch.County..Texas..Estimate McLennan.County..Texas..Estimate
1                                65                            2,152
2                                 0                              358
3                                 6                            2,611
4                                 0                            1,056
5                                 0                              440
6                                 5                              682
  McMullen.County..Texas..Estimate Madison.County..Texas..Estimate
1                                8                              80
2                                4                              27
3                               22                              40
4                                0                               0
5                                0                               5
6                                0                              56
  Marion.County..Texas..Estimate Martin.County..Texas..Estimate
1                             52                              0
2                              0                              6
3                             48                             74
4                             41                              6
5                             25                             24
6                             12                             35
  Mason.County..Texas..Estimate Matagorda.County..Texas..Estimate
1                             0                               411
2                             0                                77
3                             0                               665
4                             0                               176
5                             0                                12
6                             0                                38
  Maverick.County..Texas..Estimate Medina.County..Texas..Estimate
1                              685                            331
2                              158                             88
3                              727                            464
4                              528                             94
5                              114                             37
6                              310                             84
  Menard.County..Texas..Estimate Midland.County..Texas..Estimate
1                             12                           1,157
2                              0                             302
3                              0                             829
4                              0                             279
5                              0                             375
6                             18                             219
  Milam.County..Texas..Estimate Mills.County..Texas..Estimate
1                            49                             6
2                            14                             0
3                           241                            18
4                           187                             5
5                            30                             0
6                            10                             0
  Mitchell.County..Texas..Estimate Montague.County..Texas..Estimate
1                               34                              120
2                               24                               29
3                                9                              211
4                                4                               25
5                                0                               65
6                                0                               20
  Montgomery.County..Texas..Estimate Moore.County..Texas..Estimate
1                              3,386                           266
2                                623                             0
3                              2,256                           204
4                              1,782                            18
5                                470                             0
6                                884                            49
  Morris.County..Texas..Estimate Motley.County..Texas..Estimate
1                             67                              2
2                              8                              0
3                             84                              2
4                             43                              0
5                             16                              6
6                             16                              0
  Nacogdoches.County..Texas..Estimate Navarro.County..Texas..Estimate
1                                 469                             325
2                                 152                              79
3                                 654                             600
4                                 197                             305
5                                  32                              85
6                                 102                             194
  Newton.County..Texas..Estimate Nolan.County..Texas..Estimate
1                            190                            34
2                              5                            18
3                            260                            24
4                              9                            29
5                              4                            73
6                             48                             8
  Nueces.County..Texas..Estimate Ochiltree.County..Texas..Estimate
1                          2,874                                41
2                            904                                 0
3                          3,756                                67
4                          1,806                                57
5                            525                                 3
6                            907                                18
  Oldham.County..Texas..Estimate Orange.County..Texas..Estimate
1                             20                            666
2                              8                            101
3                              3                            483
4                              0                            271
5                              0                            104
6                              9                             30
  Palo.Pinto.County..Texas..Estimate Panola.County..Texas..Estimate
1                                228                            165
2                                 29                             70
3                                233                            179
4                                150                             77
5                                 60                             23
6                                 30                             26
  Parker.County..Texas..Estimate Parmer.County..Texas..Estimate
1                            330                             54
2                             60                             16
3                            685                             20
4                            251                             35
5                             30                              0
6                            174                             13
  Pecos.County..Texas..Estimate Polk.County..Texas..Estimate
1                           183                          504
2                            64                           32
3                           240                          354
4                           190                          288
5                            48                           55
6                           102                          132
  Potter.County..Texas..Estimate Presidio.County..Texas..Estimate
1                          1,518                               73
2                             61                               78
3                          1,616                              473
4                          1,112                                0
5                            265                              103
6                            359                                0
  Rains.County..Texas..Estimate Randall.County..Texas..Estimate
1                            51                             438
2                            13                              65
3                            88                             836
4                             0                             110
5                             2                             125
6                            15                             125
  Reagan.County..Texas..Estimate Real.County..Texas..Estimate
1                             19                           44
2                              0                            0
3                             21                           14
4                              0                            5
5                              4                            5
6                              0                           45
  Red.River.County..Texas..Estimate Reeves.County..Texas..Estimate
1                                55                            205
2                                11                              0
3                                37                            205
4                               108                             82
5                                11                              8
6                                38                             65
  Refugio.County..Texas..Estimate Roberts.County..Texas..Estimate
1                              56                               0
2                               0                               0
3                              45                               2
4                               0                              16
5                               4                               0
6                               3                               0
  Robertson.County..Texas..Estimate Rockwall.County..Texas..Estimate
1                               144                               37
2                                32                               28
3                                95                              256
4                                45                               86
5                                46                               69
6                                72                              138
  Runnels.County..Texas..Estimate Rusk.County..Texas..Estimate
1                              61                          474
2                               6                           99
3                              59                          312
4                               0                          331
5                               0                           14
6                              15                           64
  Sabine.County..Texas..Estimate San.Augustine.County..Texas..Estimate
1                             22                                    47
2                             25                                     0
3                             17                                   159
4                             59                                    36
5                             19                                     0
6                             35                                    33
  San.Jacinto.County..Texas..Estimate San.Patricio.County..Texas..Estimate
1                                 192                                  614
2                                  91                                   81
3                                 247                                  810
4                                 136                                  203
5                                  81                                   21
6                                  15                                  243
  San.Saba.County..Texas..Estimate Schleicher.County..Texas..Estimate
1                               68                                 14
2                                0                                  0
3                               58                                 20
4                               17                                 13
5                               12                                  0
6                                2                                  0
  Scurry.County..Texas..Estimate Shackelford.County..Texas..Estimate
1                             77                                  12
2                              0                                   0
3                            111                                   0
4                            130                                   0
5                             14                                   0
6                             29                                  48
  Shelby.County..Texas..Estimate Sherman.County..Texas..Estimate
1                            407                               3
2                             57                               0
3                            266                              27
4                            239                               5
5                             60                               3
6                            106                               1
  Smith.County..Texas..Estimate Somervell.County..Texas..Estimate
1                         1,611                                 0
2                            87                                 9
3                         2,230                                 8
4                           623                                 8
5                           190                                34
6                           525                                17
  Starr.County..Texas..Estimate Stephens.County..Texas..Estimate
1                         1,574                               44
2                           307                                0
3                         1,343                               14
4                           756                                0
5                           118                               16
6                           382                               45
  Sterling.County..Texas..Estimate Stonewall.County..Texas..Estimate
1                                0                                 4
2                                0                                 0
3                                0                                 3
4                                0                                 6
5                                0                                 0
6                                0                                 0
  Sutton.County..Texas..Estimate Swisher.County..Texas..Estimate
1                             49                              85
2                              0                               4
3                             77                             157
4                              0                              98
5                              0                               0
6                              0                              42
  Tarrant.County..Texas..Estimate Taylor.County..Texas..Estimate
1                          12,064                          1,029
2                           2,608                            156
3                          15,257                          1,197
4                           6,320                            335
5                           1,518                             92
6                           3,800                            213
  Terrell.County..Texas..Estimate Terry.County..Texas..Estimate
1                               0                           179
2                               0                           141
3                               0                           180
4                               0                           132
5                               0                            20
6                               0                             0
  Throckmorton.County..Texas..Estimate Titus.County..Texas..Estimate
1                                    0                           284
2                                    0                            71
3                                    0                           467
4                                   10                           127
5                                    0                            98
6                                    0                            59
  Tom.Green.County..Texas..Estimate Travis.County..Texas..Estimate
1                               973                          5,262
2                                73                            820
3                               713                          6,774
4                               358                          2,888
5                                48                            982
6                                42                          2,125
  Trinity.County..Texas..Estimate Tyler.County..Texas..Estimate
1                              61                            63
2                              23                            27
3                              30                           264
4                              96                           103
5                               0                            20
6                              92                            59
  Upshur.County..Texas..Estimate Upton.County..Texas..Estimate
1                            121                            17
2                             76                             0
3                            409                            58
4                            236                            44
5                             66                             0
6                             13                             9
  Uvalde.County..Texas..Estimate Val.Verde.County..Texas..Estimate
1                            357                               542
2                             42                                39
3                            356                               403
4                            285                               199
5                            157                                61
6                            215                                25
  Van.Zandt.County..Texas..Estimate Victoria.County..Texas..Estimate
1                               263                              769
2                                23                              117
3                               401                              725
4                               196                              325
5                                24                              145
6                               135                              240
  Walker.County..Texas..Estimate Waller.County..Texas..Estimate
1                            571                            149
2                              9                              0
3                            549                            274
4                            192                            148
5                             87                            141
6                             83                            105
  Ward.County..Texas..Estimate Washington.County..Texas..Estimate
1                           62                                252
2                            0                                 14
3                          179                                117
4                           21                                140
5                           31                                 32
6                            0                                 50
  Webb.County..Texas..Estimate Wharton.County..Texas..Estimate
1                        3,554                             386
2                          714                              33
3                        4,426                             321
4                        1,829                             203
5                          631                              69
6                        1,490                               0
  Wheeler.County..Texas..Estimate Wichita.County..Texas..Estimate
1                              87                             834
2                               0                             175
3                              50                           1,051
4                              15                             549
5                               0                              45
6                              16                             292
  Wilbarger.County..Texas..Estimate Willacy.County..Texas..Estimate
1                                28                             311
2                                19                               1
3                               127                             257
4                                53                             139
5                                 0                              60
6                               247                             131
  Williamson.County..Texas..Estimate Wilson.County..Texas..Estimate
1                              1,519                            122
2                                113                            101
3                              2,262                            242
4                                810                             22
5                                430                             46
6                                621                            141
  Winkler.County..Texas..Estimate Wise.County..Texas..Estimate
1                              35                          238
2                              35                           43
3                              55                          419
4                              38                          174
5                              57                           30
6                              29                           35
  Wood.County..Texas..Estimate Yoakum.County..Texas..Estimate
1                          148                            128
2                            1                              0
3                          145                             48
4                          142                             45
5                           35                              0
6                          110                             40
  Young.County..Texas..Estimate Zapata.County..Texas..Estimate
1                           157                            371
2                            14                              0
3                           271                            622
4                            50                            236
5                            56                             51
6                            77                             93
  Zavala.County..Texas..Estimate
1                            164
2                            119
3                            332
4                            104
5                              0
6                            109
write.csv(file = "cleaned_data/children_under_poverty_line_2023_raw.csv", children_below_poverty_line)

Cleaning data for children below poverty line by making sure all counties are accounted for and joining to regions data set for region aggregation maps.

children_below_poverty_line_cleaned <- children_below_poverty_line |>
  mutate(across(-Label..Grouping., ~ as.numeric(gsub(",", "", .)))) |>
  clean_names() |>
  pivot_longer(
    cols = contains("county"),
    names_to = "county",
    values_to = "estimate",
    values_drop_na = TRUE) |>
   mutate(county = sapply(sub("_", "", str_to_title(sub("_county_texas_estimate", "", county))), fix_names)) |>
  rename (County = county)
missing_regions <- anti_join(regions, children_below_poverty_line_cleaned, by = "County")
poverty_with_regions <- left_join(children_below_poverty_line_cleaned, regions , by = "County")

head(missing_regions)
  Region County
1  State  Texas
children_regions <- poverty_with_regions |>
  group_by(Region) |>
  summarise(estimate_total = sum(estimate))

percent_children_regions_poverty <- left_join(children_regions, region_children_pop, by = "Region") |>
  mutate(percent_pov = (estimate_total / child_region_pop) * 100)

head(percent_children_regions_poverty)
# A tibble: 6 × 4
  Region        estimate_total child_region_pop percent_pov
  <chr>                  <dbl>            <int>       <dbl>
1 Alamo                 132766           725607        18.3
2 Capitol                63648           573935        11.1
3 Central Texas          58949           304703        19.3
4 Gulf Coast            360412          1918966        18.8
5 High Plains            41316           217274        19.0
6 Metroplex             301659          2073845        14.5
write.csv(file = "cleaned_data/children_poverty_texas_regions.csv", percent_children_regions_poverty, row.names = FALSE)

Cleaning datasets to calculate children living below poverty line by counties in Texas.

clean_past12 <- poverty_past12 |>
  select(Label..Grouping., contains("Percent")) |>
  mutate(Label..Grouping. = str_trim(Label..Grouping., side = "left"))


children_past12 <- clean_past12 |>
  filter(Label..Grouping. %in% c("Under 18 years"))

pivot_children_past12 <- children_past12 |>
  mutate(across(-Label..Grouping., ~ as.numeric(gsub("%", "", .)))) |>
  clean_names() |>
  select(where(~ !is.na(.x[1]))) |>
  pivot_longer(
    cols = contains("county"),
    names_to = "county",
    values_to = "estimate",
    values_drop_na = TRUE) |>
   mutate(county = sapply(sub("_", "", str_to_title(sub("_county_texas_percent_below_poverty_level_estimate", "", county))), fix_names)) |>
  rename (County = county) |>
  select(County, estimate)
Warning: There were 255 warnings in `mutate()`.
The first warning was:
ℹ In argument: `across(-Label..Grouping., ~as.numeric(gsub("%", "", .)))`.
Caused by warning:
! NAs introduced by coercion
ℹ Run `dplyr::last_dplyr_warnings()` to see the 254 remaining warnings.
final_pivot_children_past12 <- left_join(location_fips, pivot_children_past12, by = "County") |>
   mutate(County = paste0(County, " County"))

head(final_pivot_children_past12)
  Label           County estimate
1 48001  Anderson County     23.5
2 48003   Andrews County     13.2
3 48005  Angelina County     22.5
4 48007   Aransas County     29.9
5 48009    Archer County     20.6
6 48011 Armstrong County      5.0
write.csv(file = "cleaned_data/children_poverty_by_county.csv", final_pivot_children_past12, row.names = FALSE)

Cleaning and aggregating poverty by age groups for all of Texas

clean_poverty_age <- clean_past12 |> 
  filter(Label..Grouping. %in% c("Under 18 years", "18 to 34 years", "35 to 64 years", "65 years and over")) |> 
  mutate(across(-Label..Grouping., ~ as.numeric(gsub("%", "", .)))) |> 
  select(where(~ !any(is.na(.)))) |> 
  clean_names() |>
  select(label_grouping, texas_percent_below_poverty_level_estimate)
Warning: There were 255 warnings in `mutate()`.
The first warning was:
ℹ In argument: `across(-Label..Grouping., ~as.numeric(gsub("%", "", .)))`.
Caused by warning:
! NAs introduced by coercion
ℹ Run `dplyr::last_dplyr_warnings()` to see the 254 remaining warnings.
head(clean_poverty_age)
     label_grouping texas_percent_below_poverty_level_estimate
1    Under 18 years                                       19.3
2    18 to 34 years                                       15.4
3    35 to 64 years                                       10.2
4 65 years and over                                       11.4
write.csv(file = "cleaned_data/poverty_by_age.csv", clean_poverty_age, row.names = FALSE)

Cleaning and aggregating by Race and Ethnicity groups for Texas.

clean_past12_re <- poverty_past12 |>
  select(Label..Grouping., contains("Estimate")) |>
  mutate(Label..Grouping. = str_trim(Label..Grouping., side = "left"))

race_ethnicity_past12 <- clean_past12_re |>
  filter(Label..Grouping. %in% c("Black or African American alone", "American Indian and Alaska Native alone", "Asian alone", "Native Hawaiian and Other Pacific Islander alone", "Some other race alone", "Two or more races", "Hispanic or Latino origin (of any race)", "White alone, not Hispanic or Latino"))
  

pivot_race_ethnicity_past12 <- race_ethnicity_past12 |>
  mutate(across(-Label..Grouping., ~ as.numeric(gsub(",", "", gsub("%", "", .))))) |>
  clean_names() |>
  select(label_grouping, matches("texas_below_poverty_level_estimate|texas_total_estimate")) |>
  pivot_longer(
    cols = -label_grouping, 
    names_to = "County",
    values_to = "estimate"
  ) |>
  mutate(
    Estimate_Type = case_when(
      grepl("_total_estimate$", County) ~ "total_estimate",
      grepl("_below_poverty_level_estimate$", County) ~ "below_poverty_level_estimate"
    ),
    County = sapply(
      sub("_", "", str_to_title(sub("_county_texas_.*", "", County))),
      fix_names
    )
  ) |>
  pivot_wider(
    names_from = Estimate_Type,
    values_from = estimate
  ) |>
  rename(race_ethnicity = label_grouping) |>
  mutate(
    race_ethnicity = case_when(
      race_ethnicity %in% c(
        "Asian alone", 
        "Native Hawaiian and Other Pacific Islander alone"
      ) ~ "Asian and Pacific Islander",
      TRUE ~ race_ethnicity
    )
  ) |>
  filter(County == "Texastotal_estimate" | County == "Texasbelow_poverty_level_estimate")
Warning: There were 151 warnings in `mutate()`.
The first warning was:
ℹ In argument: `across(...)`.
Caused by warning:
! NAs introduced by coercion
ℹ Run `dplyr::last_dplyr_warnings()` to see the 150 remaining warnings.
#dataset with tiled data 
pivot_race_ethnicity_past12
# A tibble: 16 × 4
   race_ethnicity                   County total_estimate below_poverty_level_…¹
   <chr>                            <chr>           <dbl>                  <dbl>
 1 Black or African American alone  Texas…        3412351                     NA
 2 Black or African American alone  Texas…             NA                 642879
 3 American Indian and Alaska Nati… Texas…         164958                     NA
 4 American Indian and Alaska Nati… Texas…             NA                  24249
 5 Asian and Pacific Islander       Texas…        1490702                     NA
 6 Asian and Pacific Islander       Texas…             NA                 137648
 7 Asian and Pacific Islander       Texas…          26391                     NA
 8 Asian and Pacific Islander       Texas…             NA                   4817
 9 Some other race alone            Texas…        2248629                     NA
10 Some other race alone            Texas…             NA                 447841
11 Two or more races                Texas…        4324720                     NA
12 Two or more races                Texas…             NA                 726066
13 Hispanic or Latino origin (of a… Texas…       11472875                     NA
14 Hispanic or Latino origin (of a… Texas…             NA                2172978
15 White alone, not Hispanic or La… Texas…       11480912                     NA
16 White alone, not Hispanic or La… Texas…             NA                 953016
# ℹ abbreviated name: ¹​below_poverty_level_estimate
#went in and fixed in excel 
final_re_poverty <- read.csv("cleaned_data/asian_aggregated_re_poverty.csv") |>
  mutate(percent = below_poverty_level_estimate / total_estimate)

head(final_re_poverty)
                           race_ethnicity              County total_estimate
1         Black or African American alone Texastotal_estimate        3412351
2 American Indian and Alaska Native alone Texastotal_estimate         164958
3              Asian and Pacific Islander Texastotal_estimate        1517093
4                   Some other race alone Texastotal_estimate        2248629
5                       Two or more races Texastotal_estimate        4324720
6 Hispanic or Latino origin (of any race) Texastotal_estimate       11472875
  below_poverty_level_estimate    percent
1                       642879 0.18839768
2                        24249 0.14700105
3                       142465 0.09390657
4                       447841 0.19916180
5                       726066 0.16788740
6                      2172978 0.18940135
write.csv(file = "cleaned_data/final_re_poverty.csv", final_re_poverty, row.names = FALSE)

IPUMS microdata was used to be able to find crossroad between English speaking ability and poverty level within the state of Texas. Microdata is “the Integrated Public Use Microdata Series consists of a series of compatible-format individual-level representative samples of the United States.”

These microdata samples allow researchers to analyze demographic, social, and economic characteristics of populations over time and across different geographic areas. IPUMS provides access to microdata from both U.S. censuses and surveys, as well as international sources. 

ipums_data <- read_ipums_micro("raw_data/usa_00015.xml")
Use of data from IPUMS USA is subject to conditions including that users should cite the data appropriately. Use command `ipums_conditions()` for more details.
cleaned_ipums <- ipums_data |>
  filter(YEAR > 2013) |>
  filter(POVERTY != 0) |>
  filter( !is.na(SPEAKENG) & SPEAKENG != 0 & SPEAKENG !=  8 & SPEAKENG != 9) |>
  filter(!is.na(VETSTAT) & VETSTAT != 0 & VETSTAT != 9) |>
  mutate(SPEAKENG_LABEL = case_when(
    SPEAKENG == 1 ~ "Does not speak English",
    SPEAKENG == 2 ~ "Yes, speaks English...",
    SPEAKENG == 3 ~ "Yes, speaks only English",
    SPEAKENG == 4 ~ "Yes, speaks very well",
    SPEAKENG == 5 ~ "Yes, speaks well",
    SPEAKENG == 6 ~ "Yes, but not well",
    TRUE ~ "Unknown" 
  )) |> 
  mutate(count_dummy = 1)

below_poverty_threshold <- cleaned_ipums |>
  filter(POVERTY <= 100) 
survey_design_below_pl <- svydesign(
  id = ~CLUSTER,          
  weights = ~PERWT,       
  data = cleaned_ipums
)

#calculate the mean of POVERTY grouped by SPEAKENG
avg_poverty_by_speakeng <- svyby(
  ~POVERTY,               
  ~SPEAKENG,              
  survey_design_below_pl, 
  svymean,               
  vartype = "ci"         
) |>
  mutate(SPEAKENG_LABEL = case_when(
    SPEAKENG == 1 ~ "Does not speak English",
    SPEAKENG == 2 ~ "Yes, speaks English...",
    SPEAKENG == 3 ~ "Yes, speaks only English",
    SPEAKENG == 4 ~ "Yes, speaks very well",
    SPEAKENG == 5 ~ "Yes, speaks well",
    SPEAKENG == 6 ~ "Yes, but not well",
    TRUE ~ "Unknown"  # Fallback for unexpected values
  ))

#veteran status
avg_poverty_by_vetstat <- svyby(
  ~POVERTY,               
  ~VETSTAT,              
  survey_design_below_pl, 
  svymean,               
  vartype = "ci"         
)
write.csv(file = "cleaned_data/poverty_by_speakeng.csv", avg_poverty_by_speakeng, row.names = FALSE)

Speak English - Separating by Poverty Level

ipums_100_199 <- cleaned_ipums |>
  filter(POVERTY > 100 & POVERTY < 200)

ipums_200_299 <- cleaned_ipums |>
  filter(POVERTY > 200 & POVERTY < 300)

ipums_300_399 <- cleaned_ipums |>
  filter(POVERTY > 300 & POVERTY < 400)

ipums_400_499 <- cleaned_ipums |>
  filter(POVERTY > 400 & POVERTY < 500)

ipums_500 <- cleaned_ipums |>
  filter(POVERTY > 500)

Since this is a survey format, it needs to be put into a survey design to make sure weights are applied and data is accurate and scaled accordingly to the population it is trying to represent.

#below poverty line
survey_design_below_pl <- svydesign(
  id = ~CLUSTER,          
  weights = ~PERWT,       
  data = below_poverty_threshold
)

Since ENG is coded in a number, using that as dummy to calculate percentage for those below and above poverty level.

#poverty 
survey_design_below_pl <- svydesign(
  id = ~CLUSTER,           
  weights = ~PERWT,        
  data = below_poverty_threshold
)

#all total counts 
survey_design_all_speakeng_groups <- svydesign(
  id = ~CLUSTER,           
  weights = ~PERWT,        
  data = cleaned_ipums
)

#below poverty line 
total_speakeng_bfpl <- svyby(
  ~count_dummy,            
  ~SPEAKENG_LABEL,        
  survey_design_below_pl, 
  svytotal,                
  vartype = "ci"           
) |>
  rename(total_below_fpl = count_dummy) |>
  select(SPEAKENG_LABEL, total_below_fpl)

total_speakeng_bfpl
                                   SPEAKENG_LABEL total_below_fpl
Does not speak English     Does not speak English          389586
Yes, but not well               Yes, but not well          384473
Yes, speaks only English Yes, speaks only English         2733474
Yes, speaks very well       Yes, speaks very well         1072719
Yes, speaks well                 Yes, speaks well          410834
#total counts
total_speakeng_all <- svyby(
  ~count_dummy,            
  ~SPEAKENG_LABEL,        
  survey_design_all_speakeng_groups, 
  svytotal,                
  vartype = "ci"           
) |>
  rename(total_speakeng_est = count_dummy) |>
  select(SPEAKENG_LABEL, total_speakeng_est)

total_speakeng_all
                                   SPEAKENG_LABEL total_speakeng_est
Does not speak English     Does not speak English            1372715
Yes, but not well               Yes, but not well            2075095
Yes, speaks only English Yes, speaks only English           28890673
Yes, speaks very well       Yes, speaks very well            9972294
Yes, speaks well                 Yes, speaks well            2953985
merged_speakeng <- left_join(total_speakeng_bfpl, total_speakeng_all, by = "SPEAKENG_LABEL") |>
  mutate(percent_poverty = total_below_fpl / total_speakeng_est) |>
  mutate(percent_not_in_poverty = 1 - percent_poverty)

merged_speakeng
            SPEAKENG_LABEL total_below_fpl total_speakeng_est percent_poverty
1   Does not speak English          389586            1372715      0.28380691
2        Yes, but not well          384473            2075095      0.18527971
3 Yes, speaks only English         2733474           28890673      0.09461441
4    Yes, speaks very well         1072719            9972294      0.10756993
5         Yes, speaks well          410834            2953985      0.13907789
  percent_not_in_poverty
1              0.7161931
2              0.8147203
3              0.9053856
4              0.8924301
5              0.8609221
write.csv(file = "cleaned_data/speakeng_poverty.csv", merged_speakeng, row.names = FALSE)

Data from 2013-2023 was pulled from KidsCount and cleaned to output a clean dataset for visualization.

#over last decade 
options(scipen = 999)
poverty_over_time <- read.csv("raw_data/poverty_over_time.csv") |>
  filter(TimeFrame > 2012) |>
  filter(DataFormat == "Percent" & LocationType == "State") |>
  select(Data, TimeFrame) 


poverty_2023 <- get_acs(
  survey = "acs5",
  state = "TX",
  year = 2023,
  geography = "state",
  variables = c(total_population = "B17001_001E",
                total_below_poverty = "B17001_002E"), 
  geometry = F, output = "wide") |>
  mutate(percent_poverty = total_below_poverty/total_population) |>
  select(percent_poverty) |>
  rename(Data = percent_poverty) |>
  mutate(TimeFrame = 2023)
Getting data from the 2019-2023 5-year ACS
Warning: • You have not set a Census API key. Users without a key are limited to 500
queries per day and may experience performance limitations.
ℹ For best results, get a Census API key at
http://api.census.gov/data/key_signup.html and then supply the key to the
`census_api_key()` function to use it throughout your tidycensus session.
This warning is displayed once per session.
final_poverty_over_time <- rbind(poverty_2023, poverty_over_time)

head(final_poverty_over_time)
# A tibble: 6 × 2
   Data TimeFrame
  <dbl>     <dbl>
1 0.138      2023
2 0.136      2019
3 0.149      2018
4 0.147      2017
5 0.156      2016
6 0.172      2014
write.csv(file = "cleaned_data/poverty_2013_2023_TX.csv", final_poverty_over_time, row.names = FALSE)

POVERTY Disaggregated Race

Function was made to clean poverty data since it repeats many of the same processes for each group

clean_poverty_data <- function(raw_dataset) {
  
  cleaned_poverty_dataset <- raw_dataset |>
    rename(Race_Group = Recoded.detailed.race.code)|>
  mutate(
    Race_Group = case_when(
      Race_Group %in% c("American Indian alone", 
                        "Alaska Native alone", 
                        "American Indian and Alaska Native tribes specified; or American Indian or Alaska Native, not specified and no other races") ~ "American Indian and Alaska Native",
      Race_Group %in% c("Asian alone", 
                        "Native Hawaiian and Other Pacific Islander alone") ~ "Asian and Pacific Islander",
      TRUE ~ Race_Group
    )
  ) |>
  group_by(Race_Group) |>
  mutate(Total.Recode.for.Recoded.detailed.Hispanic.origin..HISP_RC4. = as.numeric(gsub(",", "", Total.Recode.for.Recoded.detailed.Hispanic.origin..HISP_RC4.)), 
         Hispanic = as.numeric(gsub(",", "", Hispanic)), 
         Non.Hispanic = as.numeric(gsub(",", "", Non.Hispanic)), 
         Total = as.numeric(gsub(",", "", Total))) |>
  summarise(
    Hispanic = sum(Hispanic, na.rm = TRUE),
    Non_Hispanic = sum(Non.Hispanic, na.rm = TRUE), 
    Total.Recode.for.Recoded.detailed.Hispanic.origin..HISP_RC4. = sum(Total.Recode.for.Recoded.detailed.Hispanic.origin..HISP_RC4., na.rum = TRUE), 
    Total = sum(Total, na.rm = TRUE))
  
  hispanic <- as.numeric(cleaned_poverty_dataset[1, 2])

  final_wo_hisp <- cleaned_poverty_dataset |>
  select(Race_Group, Non_Hispanic, Total) |>
  rename(Race_PL_Total = Non_Hispanic) |>
  select(Race_Group, Race_PL_Total, Total)
  
  print(final_wo_hisp)

  hispanic_set <- data.frame(
  Race_Group = "Hispanic",
  Race_PL_Total = hispanic,
  Total = 9255820
  )


  final_poverty_dataset <- rbind(final_wo_hisp, hispanic_set) |>
    filter(Race_Group != "" & Race_Group != 'Total')


  within_povertylevel_total = sum(final_poverty_dataset$Race_PL_Total)

  final_poverty_dataset <- final_poverty_dataset |>
    mutate(Percent_of_Race = Race_PL_Total/Total, 
           Percent_of_PL_Group = Race_PL_Total/within_povertylevel_total)

  return(final_poverty_dataset)
}
#below federal poverty level
poverty_disaggregated_bfpl <- read.csv("raw_data/all_poverty_disaggregated_2023.csv") 
final_bfpl <- clean_poverty_data(poverty_disaggregated_bfpl) |>
  mutate(Poverty_Level = "Below Federal Poverty Line")
# A tibble: 8 × 3
  Race_Group                          Race_PL_Total    Total
  <chr>                                       <dbl>    <dbl>
1 ""                                        1600513 19794033
2 "American Indian and Alaska Native"          5178   195368
3 "Asian and Pacific Islander"               135253   912191
4 "Black or African American alone"          539087  2633751
5 "Some other race alone"                      9833  2340874
6 "Total"                                   1600513 19794033
7 "Two or More Races"                         93662  5242552
8 "White alone"                              817500  8469297
write.csv(file = "cleaned_data/hispanic_disaggregated_bfpl_2023.csv", final_bfpl, row.names = FALSE)

#100 to 199
poverty_100_to_199 <- read.csv("raw_data/100_to_199.csv")
final_100_to_199 <- clean_poverty_data(poverty_100_to_199) |>
  mutate(Poverty_Level = "100% to 199% above Federal Poverty Line")
# A tibble: 8 × 3
  Race_Group                          Race_PL_Total    Total
  <chr>                                       <dbl>    <dbl>
1 ""                                        2148766 19794033
2 "American Indian and Alaska Native"          6844   195368
3 "Asian and Pacific Islander"               167913   912191
4 "Black or African American alone"          623038  2633751
5 "Some other race alone"                     20785  2340874
6 "Total"                                   2148766 19794033
7 "Two or More Races"                        125923  5242552
8 "White alone"                             1204263  8469297
#200 to 299
poverty_200_to_299 <- read.csv("raw_data/200_to_299.csv")
final_200_to_299 <- clean_poverty_data(poverty_200_to_299) |>
  mutate(Poverty_Level = "200% to 299% above Federal Poverty Line")
# A tibble: 8 × 3
  Race_Group                          Race_PL_Total    Total
  <chr>                                       <dbl>    <dbl>
1 ""                                        2465194 19794033
2 "American Indian and Alaska Native"          5099   195368
3 "Asian and Pacific Islander"               203170   912191
4 "Black or African American alone"          571456  2633751
5 "Some other race alone"                     20456  2340874
6 "Total"                                   2465194 19794033
7 "Two or More Races"                        143777  5242552
8 "White alone"                             1521236  8469297
#300 to 399
poverty_300_to_399 <- read.csv("raw_data/300_to_399.csv")
final_300_to_399 <- clean_poverty_data(poverty_300_to_399) |>
  mutate(Poverty_Level = "300% to 399% above Federal Poverty Line")
# A tibble: 8 × 3
  Race_Group                          Race_PL_Total    Total
  <chr>                                       <dbl>    <dbl>
1 ""                                        2361133 19794033
2 "American Indian and Alaska Native"          5320   195368
3 "Asian and Pacific Islander"               214664   912191
4 "Black or African American alone"          468303  2633751
5 "Some other race alone"                     21061  2340874
6 "Total"                                   2361133 19794033
7 "Two or More Races"                        121393  5242552
8 "White alone"                             1530392  8469297
#400 to 499
poverty_400_to_499 <- read.csv("raw_data/400_to_499.csv")
final_400_to_499 <- clean_poverty_data(poverty_400_to_499) |>
  mutate(Poverty_Level = "400% to 499% above Federal Poverty Line")
# A tibble: 8 × 3
  Race_Group                          Race_PL_Total    Total
  <chr>                                       <dbl>    <dbl>
1 ""                                        1940373 19794033
2 "American Indian and Alaska Native"          4102   195368
3 "Asian and Pacific Islander"               161565   912191
4 "Black or African American alone"          354136  2633751
5 "Some other race alone"                     13607  2340874
6 "Total"                                   1940373 19794033
7 "Two or More Races"                         90327  5242552
8 "White alone"                             1316636  8469297
#500+
poverty_500 <- read.csv("raw_data/500+.csv")
final_500 <- clean_poverty_data(poverty_500) |>
  mutate(Poverty_Level = "500% or more above Federal Poverty Line")
# A tibble: 8 × 3
  Race_Group                          Race_PL_Total    Total
  <chr>                                       <dbl>    <dbl>
1 ""                                          22234 19794033
2 "American Indian and Alaska Native"            60   195368
3 "Asian and Pacific Islander"                 3578   912191
4 "Black or African American alone"            2686  2633751
5 "Some other race alone"                         0  2340874
6 "Total"                                     22234 19794033
7 "Two or More Races"                           568  5242552
8 "White alone"                               15342  8469297
final_poverty_line_data <- rbind(final_bfpl, final_100_to_199, final_200_to_299, final_300_to_399, final_400_to_499, final_500)

write.csv(file = "cleaned_data/all_poverty_levels_race_disaggregated_2023.csv", final_poverty_line_data, row.names = FALSE)

The next few chunks of code clean difference socioeconomic indiactors and tries to break them down by region, county and/or aggregates for the state.

In this section, using sf to help in outputting a file that’s compatible with ArcGIS to make a regional map and dissolving counties to create visual regions on Texas map for children and poverty.

library(sf)
Linking to GEOS 3.13.0, GDAL 3.8.5, PROJ 9.5.1; sf_use_s2() is TRUE
child_poverty_county <- get_acs(
  survey = "acs5",
  state = "TX",
  year = 2023,
  geography = "county",
  variables = c(totpop = "B05010_002"), #total under 19
  geometry=T,
  output="wide") |>
  mutate(NAME = gsub(" County, Texas", "", NAME)) |>
  rename(County = NAME)
Getting data from the 2019-2023 5-year ACS
Downloading feature geometry from the Census website.  To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |                                                                      |   1%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |==                                                                    |   4%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |===                                                                   |   5%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=====                                                                 |   8%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |=======                                                               |  11%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |=========                                                             |  14%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |============                                                          |  18%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==============                                                        |  21%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |================                                                      |  24%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |=================                                                     |  25%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |===================                                                   |  28%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=====================                                                 |  31%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |=======================                                               |  34%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |==========================                                            |  38%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |==============================                                        |  44%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=================================                                     |  48%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |===================================                                   |  51%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |=====================================                                 |  54%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |========================================                              |  58%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |==========================================                            |  61%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |============================================                          |  64%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |===============================================                       |  68%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |=================================================                     |  71%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |===================================================                   |  74%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |========================================================              |  81%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |==========================================================            |  84%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |===========================================================           |  85%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |===============================================================       |  91%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |=================================================================     |  94%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |====================================================================  |  98%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================|  99%
  |                                                                            
  |======================================================================| 100%
child_pov_regions <- left_join(child_poverty_county, regions, by = "County") |>
  mutate(County = paste(County, "County")) |>
   select(GEOID, County, Region, geometry)
dissolve_child_pov_regions <- child_pov_regions |>
  group_by(Region) |>
  summarise(
    geometry = st_union(geometry)          
  )

final_percent_child_pov_dissolve <- left_join(dissolve_child_pov_regions, percent_children_regions_poverty, by = "Region") |>
  select(Region, geometry, percent_pov)

st_write(final_percent_child_pov_dissolve, "cleaned_data/arcgic_region_child_pov.gpkg", append=FALSE)
Deleting layer `arcgic_region_child_pov' using driver `GPKG'
Writing layer `arcgic_region_child_pov' to data source 
  `cleaned_data/arcgic_region_child_pov.gpkg' using driver `GPKG'
Writing 12 features with 2 fields and geometry type Unknown (any).

Nativity and citizenship status and poverty level distributions.

nativity <- get_acs(
  survey = "acs1",
  state = "TX",
  year = 2023,
  geography = "state",
  variables = c(tot_pop = "B05001_001E", 
                born_in_us = "B05001_002E",
                puerto_rico_or_island = "B05001_003E", 
                born_abroad_us = "B05001_004E", 
                naturalized = "B05001_005E",
                not_citizen = "B05001_006E"), #total in pov by nativity
  geometry=F,
  output="wide")
Getting data from the 2023 1-year ACS
The 1-year ACS provides data for geographies with populations of 65,000 and greater.
nativity_poverty <- get_acs(
  survey = "acs1",
  state = "TX",
  year = 2023,
  geography = "state",
  variables = c(tot_pop_pov = "C17025_002E", 
                below_pov_native = "C17025_003E", 
                foreign_born_nat_cit = "C17025_005E", 
                foreign_born_not_cit = "C17025_006E",
                foreign_born = "C17025_004E",
                not_citizen = "C17025_006E"), #total in pov by nativity
  geometry=F,
  output="wide")
Getting data from the 2023 1-year ACS
The 1-year ACS provides data for geographies with populations of 65,000 and greater.
write.csv(file = "cleaned_data/total_nativity_nums.csv", nativity, row.names = FALSE)
write.csv(file = "cleaned_data/total_pov_nativity_nums.csv", nativity_poverty, row.names = FALSE)

head(nativity_poverty)
# A tibble: 1 × 12
  GEOID NAME  tot_pop_pov C17025_002M below_pov_native C17025_003M
  <chr> <chr>       <dbl>       <dbl>            <dbl>       <dbl>
1 48    Texas     4086851       75298          3191313       61998
# ℹ 6 more variables: foreign_born_nat_cit <dbl>, C17025_005M <dbl>,
#   foreign_born_not_cit <dbl>, C17025_006M <dbl>, foreign_born <dbl>,
#   C17025_004M <dbl>
nativity_pov_dataset <- read.csv(file = "cleaned_data/nativity_dataset.csv") |>
  mutate(Total_Numbers = as.numeric(gsub(",", "", Total_Numbers)), 
         Percent_Poverty = Poverty_Total/Total_Numbers, 
         Not_Poverty = 1- Percent_Poverty) 
Warning in read.table(file = file, header = header, sep = sep, quote = quote, :
incomplete final line found by readTableHeader on
'cleaned_data/nativity_dataset.csv'
write.csv(file = "cleaned_data/final_nativity_pov.csv", nativity_pov_dataset, row.names = FALSE)
acs23d <- load_variables(year=2023,dataset = "acs5") 

Broadband and access to internet with poverty level distributions.

poverty_broadband_access <- get_acs(
  survey = "acs5",
  state = "TX",
  year = 2023,
  geography = "state",
  variables = c(totpop = "B28004_001E", 
                
                tot_less_than_ten = "B28004_002E", 
                less_than_ten_dialup = "B28004_003E",
                less_than_ten_broadband = "B28004_004E", 
                less_than_ten_nointernet = "B28004_005E",
                
                tot_ten_to_twenty = "B28004_006E", 
                ten_to_twenty_dialup = "B28004_007E",
                ten_to_twenty_broadband = "B28004_008E", 
                ten_to_twenty_nointernet = "B28004_009E", 
                
                tot_twenty_to_thirtyfive = "B28004_010E", 
                twenty_to_thirtyfive_dialup = "B28004_011E", 
                twenty_to_thirtyfive_broadband = "B28004_012E", 
                twenty_to_thirtyfive_nointernet = "B28004_013E", 
                
                tot_thirtyfive_tofifty = "B28004_014E", 
                thirtyfive_tofifty_dialup = "B28004_015E", 
                thirtyfive_tofifty_broadband = "B28004_016E", 
                thirtyfive_tofifty_nointernet = "B28004_017E", 
                
                tot_fifty_to_seventyfive = "B28004_018E", 
                fifty_to_seventyfive_dialup = "B28004_019E", 
                fifty_to_seventyfive_broadband = "B28004_020E", 
                fifty_to_seventyfive_nointernet = "B28004_021E", 
                
                tot_seventyfive_more = "B28004_022E", 
                seventyfive_more_dialup = "B28004_023E", 
                seventyfive_more_broadband = "B28004_024E", 
                seventyfive_more_nointernet = "B28004_025E"
                ), 
  geometry=F,
  output="wide") |>
  select(totpop, 
         tot_less_than_ten, less_than_ten_dialup, less_than_ten_broadband, less_than_ten_nointernet, 
         
         tot_ten_to_twenty, ten_to_twenty_dialup, ten_to_twenty_broadband, ten_to_twenty_nointernet, 
         
         tot_twenty_to_thirtyfive, twenty_to_thirtyfive_dialup, twenty_to_thirtyfive_broadband, twenty_to_thirtyfive_nointernet, 
         
         tot_thirtyfive_tofifty, thirtyfive_tofifty_dialup, thirtyfive_tofifty_broadband, thirtyfive_tofifty_nointernet, 
         
         tot_fifty_to_seventyfive, fifty_to_seventyfive_dialup, fifty_to_seventyfive_broadband, fifty_to_seventyfive_nointernet,
         
         tot_seventyfive_more, seventyfive_more_dialup, seventyfive_more_broadband, seventyfive_more_nointernet)
Getting data from the 2019-2023 5-year ACS
write.csv(file = "raw_data/acs_pull_internetaccess_poverty.csv", poverty_broadband_access, row.names = FALSE)
poverty_broadband_access
# A tibble: 1 × 25
    totpop tot_less_than_ten less_than_ten_dialup less_than_ten_broadband
     <dbl>             <dbl>                <dbl>                   <dbl>
1 10747240            535594                  808                  400614
# ℹ 21 more variables: less_than_ten_nointernet <dbl>, tot_ten_to_twenty <dbl>,
#   ten_to_twenty_dialup <dbl>, ten_to_twenty_broadband <dbl>,
#   ten_to_twenty_nointernet <dbl>, tot_twenty_to_thirtyfive <dbl>,
#   twenty_to_thirtyfive_dialup <dbl>, twenty_to_thirtyfive_broadband <dbl>,
#   twenty_to_thirtyfive_nointernet <dbl>, tot_thirtyfive_tofifty <dbl>,
#   thirtyfive_tofifty_dialup <dbl>, thirtyfive_tofifty_broadband <dbl>,
#   thirtyfive_tofifty_nointernet <dbl>, tot_fifty_to_seventyfive <dbl>, …
#verifying pivoted right way 
cleaned_broadband <- read.csv("cleaned_data/acs_broadband_income.csv") |>
  mutate(verified_totals = DialUp + Broadband + NoInternet) 

cleaned_broadband
        Income DialUp Broadband NoInternet  Totals verified_totals
1 Less than 10    808    400614     134172  535594          535594
2     10 to 20    802    484331     208995  694128          694128
3     20 to 35   2445    907991     219208 1129644         1129644
4     35 to 50   1400   1015436     151349 1168185         1168185
5     50 to 75   2308   1612782     148058 1763148         1763148
6   75 or more   3232   5246201     207108 5456541         5456541
final_broadband <- cleaned_broadband |>
  select(-verified_totals)|>
  mutate(InternetAcesss = DialUp + Broadband) |>
  mutate(percent_internet = InternetAcesss/Totals, 
         percent_nointernet = NoInternet/Totals)

write.csv(file = "cleaned_data/final_percent_internet_poverty.csv", final_broadband, row.names = FALSE)

head(final_broadband)
        Income DialUp Broadband NoInternet  Totals InternetAcesss
1 Less than 10    808    400614     134172  535594         401422
2     10 to 20    802    484331     208995  694128         485133
3     20 to 35   2445    907991     219208 1129644         910436
4     35 to 50   1400   1015436     151349 1168185        1016836
5     50 to 75   2308   1612782     148058 1763148        1615090
6   75 or more   3232   5246201     207108 5456541        5249433
  percent_internet percent_nointernet
1        0.7494894         0.25051065
2        0.6989100         0.30109000
3        0.8059495         0.19405052
4        0.8704409         0.12955910
5        0.9160263         0.08397367
6        0.9620441         0.03795591

Healthcare with poverty level distributions.

#Health Insurance Coverage Status by Ratio of Income to Poverty Level in the Past 12 Months by Age

healthcare_access_2023 <- get_acs(
  survey = "acs5", 
  state = "TX", 
  year = 2023, 
  geography = "state", 
  variables = c(totpop = "C27016_001E", 
                tot_below_pov_line = "C27016_002E", 
                children_pov_tot = "C27016_003E", 
                children_with_health = "C27016_004E", 
                children_wo_health = "C27016_005E", 
                nineteen_sixtyfour_tot = "C27016_006E", 
                nineteen_sixtyfour_with_health = "C27016_007E", 
                nineteen_sixtyfour_wo_health = "C27016_008E",
                sixty_five_plus_with_health_tot = "C27016_009E",
                sixty_five_plus_with_health = "C27016_010E", 
                sixty_five_plus_wo_health = "C27016_011E"
                ), 
      geometry=F,
      output="wide") |>
  select(totpop, tot_below_pov_line, children_pov_tot, children_with_health, children_wo_health, nineteen_sixtyfour_tot, nineteen_sixtyfour_with_health, nineteen_sixtyfour_wo_health, sixty_five_plus_with_health_tot, sixty_five_plus_with_health, sixty_five_plus_wo_health) 
Getting data from the 2019-2023 5-year ACS
write.csv(file = "raw_data/healthcare_poverty.csv", healthcare_access_2023, row.names = FALSE)
#healthcare
healthcare_pivoted <- read.csv("cleaned_data/healthcare_poverty.csv") |>
  mutate(percent_nohealth = no_healthcare/total,
         healthcare = has_healthcare/total)
Warning in read.table(file = file, header = header, sep = sep, quote = quote, :
incomplete final line found by readTableHeader on
'cleaned_data/healthcare_poverty.csv'
write.csv(file = "cleaned_data/percent_healthcare.csv", healthcare_pivoted, row.names = FALSE)

head(healthcare_pivoted)
    total has_healthcare no_healthcare          age_group percent_nohealth
1 1467094        1263507        203587           children       0.13876889
2 2090014        1151976        938038 nineteen_sixtyfour       0.44881900
3  445317         425804         19513     sixtyfive_plus       0.04381822
  healthcare
1  0.8612311
2  0.5511810
3  0.9561818

Disability with poverty level distributions.

#Median Earnings in the Past 12 Months (in 2023 Inflation-Adjusted Dollars) by Disability Status by Sex for the Civilian Noninstitutionalized Population 16 Years and Over With Earnings
disability_median_income_earnings_2023 <- get_acs(
  survey = "acs5", 
  state = "TX", 
  year = 2023,
  geography = "state", 
  variables = c(tot_pop = "B18140_001E", 
                with_dis = "B18140_002E", 
                without_dis = "B18140_005E" 
                ), 
  geometry = FALSE, 
  output = "tidy") |>
  mutate(variable = case_when(
    variable == "B18140_001" ~ "tot_pop",
    variable == "B18140_002" ~ "with_dis",
    variable == "B18140_005" ~ "without_dis",
    TRUE ~ variable 
  ))
Getting data from the 2019-2023 5-year ACS
head(disability_median_income_earnings_2023)
# A tibble: 3 × 5
  GEOID NAME  variable    estimate   moe
  <chr> <chr> <chr>          <dbl> <dbl>
1 48    Texas tot_pop        42622   180
2 48    Texas with_dis       32255   406
3 48    Texas without_dis    43736   181
write.csv(file = "cleaned_data/disability_pov_income.csv", disability_median_income_earnings_2023, row.names = FALSE)

Disability Poverty Ratios

#Poverty Status in the Past 12 Months by Disability Status by Employment Status for the Population 20 to 64 Years
disability_pov_ratio <- get_acs(
  survey = "acs5", 
  state = "TX", 
  year = 2023, 
  geography = "state", 
  variables = c(tot_pop = "B23024_001E", 
                tot_below_pov_level_20_64 = "B23024_002E", 
                tot_below_pov_dis = "B23024_003E",
                tot_below_pov_no_dis = "B23024_010E",
                no_dis_labor = "B23024_011E", 
                dis_labor = "B23024_004E",
                dis_no_labor = "B23024_009E", 
                no_dis_no_labor = "B23024_016E"
                ), 
  geometry = F, 
  output = "wide") |>
  mutate(percent_dis = tot_below_pov_dis/tot_below_pov_level_20_64,
         percent_no_dis = 1- percent_dis, 
         percent_dis_labor = dis_labor/tot_below_pov_dis, 
         percent_dis_nolabor = dis_no_labor/tot_below_pov_dis,
         percent_no_dis_labor = no_dis_labor/tot_below_pov_no_dis,
         percent_no_dis_no_labor = no_dis_no_labor/tot_below_pov_no_dis) |>
  select(tot_pop, tot_below_pov_level_20_64, tot_below_pov_dis, tot_below_pov_no_dis,dis_labor, no_dis_labor, dis_no_labor, no_dis_no_labor, percent_dis, percent_no_dis, percent_dis_labor, percent_dis_nolabor,  percent_no_dis_labor, percent_no_dis_no_labor)
Getting data from the 2019-2023 5-year ACS
overall_dis <- disability_pov_ratio |>
  select(tot_below_pov_level_20_64, tot_below_pov_dis, tot_below_pov_no_dis, percent_dis, percent_no_dis
         )
  
dis_labor <- disability_pov_ratio |>
  select(no_dis_labor, dis_labor, dis_no_labor, no_dis_no_labor, percent_dis_labor, percent_dis_nolabor, percent_no_dis_labor, percent_no_dis_no_labor)

write.csv(file = "cleaned_data/overall_dis_poverty.csv", overall_dis, row.names = FALSE)
write.csv(file = "cleaned_data/labor_dis_poverty.csv", dis_labor, row.names = FALSE)

head(dis_labor)
# A tibble: 1 × 8
  no_dis_labor dis_labor dis_no_labor no_dis_no_labor percent_dis_labor
         <dbl>     <dbl>        <dbl>           <dbl>             <dbl>
1       928199    110147       268332          712568             0.291
# ℹ 3 more variables: percent_dis_nolabor <dbl>, percent_no_dis_labor <dbl>,
#   percent_no_dis_no_labor <dbl>
head(overall_dis)
# A tibble: 1 × 5
  tot_below_pov_level_20_64 tot_below_pov_dis tot_below_pov_no_dis percent_dis
                      <dbl>             <dbl>                <dbl>       <dbl>
1                   2019246            378479              1640767       0.187
# ℹ 1 more variable: percent_no_dis <dbl>

Poverty In US to use as a comparison to poverty in Texas

us_poverty_rate <- read.csv("raw_data/usa_poverty_levels.csv") |>
  filter(TimeFrame > 2012 & Location == "United States") |>
  filter(DataFormat == "Percent") |>
  select(Location, TimeFrame, Data)

write.csv(file = "cleaned_data/us_poverty_overtime.csv", us_poverty_rate, row.names = FALSE)

head(us_poverty_rate)
       Location TimeFrame Data
1 United States      2013 0.16
2 United States      2018 0.13
3 United States      2015 0.15
4 United States      2014 0.16
5 United States      2016 0.14
6 United States      2017 0.13

Alternative approach that I would have liked to explore after learning more about tidycensus and how to data pull from it.

Data was sourced via tidycensus for ease of access (since doing it locally would require multiple files). Doing it through tidycensus enables the use of requests to the census API that makes process easier and also provides better formatting and up to date data. It honestly also makes it tidier since the tool let’s the columns be named in the data pull.

tx23state <- get_acs(
  survey = "acs1",
  state = "TX",
  year = 2023,
  geography = "state",
  variables = c(total_population = "B17001_001E",
                total_below_poverty = "B17001_002E", 
                white_alone = "B17001H_001E", #total 
                black_alone = "B17001B_001E",
                aian_alone = "B17001C_001E",
                asian_alone = "B17001D_001E",
                nhopi_alone = "B17001E_001E", 
                other_alone = "B17001F_001E",
                two_or_more_alone = "B17001G_001E", 
                hispanic_latino_alone = "B17001I_001E", 
                white_alone_below = "B17001H_002E", #below poverty 
                black_alone_below = "B17001B_002E",
                aian_alone_below = "B17001C_002E",
                asian_alone_below = "B17001D_002E",
                nhopi_alone_below = "B17001E_002E", 
                other_alone_below = "B17001F_002E",
                two_or_more_alone_below = "B17001G_002E", 
                
                hispanic_latino_alone_below = "B17001I_002E"),
  geometry=F, output="wide")
Getting data from the 2023 1-year ACS
The 1-year ACS provides data for geographies with populations of 65,000 and greater.
sum (tx23state$white_alone, tx23state$black_alone, tx23state$aian_alone, tx23state$asian_alone, tx23state$other_alone, tx23state$two_or_more_alone, tx23state$hispanic_latino_alone)
[1] 39103494
tx23state$total_population
[1] 29889559
# tx23state <- tx23state |>
#   select(total_population, total_below_poverty, white_alone, black_alone, aian_alone, asian_alone, nhopi_alone, two_or_more_alone, hispanic_latino_alone, white_alone_below, black_alone_below, aian_alone_below, asian_alone_below, nhopi_alone_below, other_alone_below, hispanic_latino_alone_below, GEOID, Name)