housing wage data by district

housing_wage_data

Purpose

Collate data to make visible the proportion of households in each legislative district that make below what is required to rent a 2 bedroom apartment in their county.

for Utahns for Fair Wages

Preliminaries

load packages

# for dplyr (and maybe ggplot2)
library(tidyverse)

# for kable for better looking html tables at end
library(knitr)

Income data by district

bring the income data csv files in.
House data from Table 19 on pg 89
URL: https://le.utah.gov/Documents/DistrictMaps/House_Dist01.pdf
Senate data from Table 19 on pg 89
URL: https://le.utah.gov/Documents/DistrictMaps/Senate_Dist01.pdf

house <- read.csv("House_table19c.csv")
senate <- read.csv("Senate_table19c.csv")

start cleaning:
remove % signs from percent columns all at once.
idea from: https://stackoverflow.com/questions/32857873/remove-a-character-from-the-entire-data-frame

senate[] <- lapply(senate, gsub, pattern='%', replacement='')
house[] <- lapply(house, gsub, pattern='%', replacement='')

convert character values to numbers.

senate[] <- lapply(senate, as.numeric)
house[] <- lapply(house, as.numeric)

House data:
only need first 2 percentage columns, but sorted by rank so districts in different orders. first, make 2 separate dataframes, 1 for each of the 2 lowest brackets and sort by district.

houseL1 <- house[,c("District_L15", "Percent_L15")]
houseL1 <- arrange(houseL1, District_L15)

houseL2 <- house[,c("District_1530", "Percent_1530")]
houseL2 <- arrange(houseL2, District_1530)

now combine them together and make a combined column by adding the percentages together. then only keep the total column and relabel the columns.

houseLcomp <- houseL1
houseLcomp$Percent_1530 <- houseL2$Percent_1530
houseLcomp$total_below30 <- houseLcomp$Percent_L15 + houseLcomp$Percent_1530
houseLcomp <- select(houseLcomp, District=District_L15, `%district<30K/yr`=total_below30)

Senate data:
only need first 2 percentage columns, but sorted by rank so districts in different orders. first, make 2 separate dataframes, 1 for each of the 2 lowest brackets and sort by district.

senateL1 <- senate[,c("District_L15", "Percent_L15")]
senateL1 <- arrange(senateL1, District_L15)

senateL2 <- senate[,c("District_1530", "Percent_1530")]
senateL2 <- arrange(senateL2, District_1530)

now combine them together and make a combined column by adding the percentages together. then only keep the total column and relabel the columns.

senateLcomp <- senateL1
senateLcomp$Percent_1530 <- senateL2$Percent_1530
senateLcomp$total_below30 <- senateLcomp$Percent_L15 + senateLcomp$Percent_1530
senateLcomp <- select(senateLcomp, District=District_L15, `%district<30K/yr`=total_below30)

Housing wages and district/county key

bring in housing wage data and key that links district to county
Housing wage data from Figure 5 on pg 9
URL: https://jobs.utah.gov/housing/publications/documents/affordablehousingplan.pdf
house district county info:
URL: http://le.utah.gov/house2/representatives.jsp
senate district county info:
URL: http://senate.utah.gov/senators/full-roster.html

hwage <- read.csv("Housing_Wage_County.csv")
house_counties <- read.csv("house_counties.csv")
senate_counties <- read.csv("senate_counties.csv")

join Senate data and make estimate column to indicate whether the final percentage is an over or under estimate.

senate_j1 <- inner_join(senate_counties, hwage)
## Joining, by = "County"
senate_j2 <- inner_join(senate_j1, senateLcomp)
## Joining, by = "District"
senate_j2$estimate <- ifelse(senate_j2$hw_year>30000, "under", "over")

join House data and make estimate column to indicate whether the final percentage is an over or under estimate.

house_j1 <- inner_join(house_counties, hwage)
## Joining, by = "County"
house_j2 <- inner_join(house_j1, houseLcomp)
## Joining, by = "District"
house_j2$estimate <- ifelse(house_j2$hw_year>30000, "under", "over")

Final products

write final dataframes to csv files.

write.csv(senate_j2, file="senate_housing_wage.csv", row.names = FALSE)
write.csv(house_j2, file="house_housing_wage.csv", row.names = FALSE)

make a prettier final table of House data.

kable(house_j2)
DistrictRepresentativeCountyhw_hourhw_year%district<30K/yrestimate
1Sandall, Scott D.Box Elder13.1727393.621over
1Sandall, Scott D.Cache13.1027248.021over
2Moss, JeffersonUtah15.7332718.49under
3Potter, Val K.Cache13.1027248.025over
4Redd, Edward H.Cache13.1027248.043over
5Webb, R. CurtCache13.1027248.019over
6Maloy, A. CoryUtah15.7332718.415under
7Fawson, Justin L.Weber16.5234361.617under
8Froerer, GageWeber16.5234361.626under
9Peterson, Jeremy A.Weber16.5234361.635under
10Pitcher, Dixon M.Weber16.5234361.631under
11Miles, Kelly B.Davis16.5234361.619under
11Miles, Kelly B.Weber16.5234361.619under
12Schultz, MikeDavis16.5234361.613under
12Schultz, MikeWeber16.5234361.613under
13Ray, PaulDavis16.5234361.616under
14Lisonbee, KarianneDavis16.5234361.621under
15Wilson, Brad R.Davis16.5234361.69under
16Handy, Stephen G.Davis16.5234361.618under
17Barlow, Stewart E.Davis16.5234361.617under
18Hawkes, Timothy D.Davis16.5234361.610under
19Ward, Raymond P.Davis16.5234361.617under
20Edwards, Rebecca P.Davis16.5234361.614under
21Sagers, Douglas V.Tooele15.4032032.018under
22Duckworth, SusanSalt Lake19.0439603.217under
23Hollins, SandraSalt Lake19.0439603.234under
24Chavez-Houck, RebeccaSalt Lake19.0439603.238under
25Briscoe, Joel K.Salt Lake19.0439603.235under
26Romero, AngelaSalt Lake19.0439603.245under
27Kennedy, Michael S.Utah15.7332718.49under
28King, Brian S.Salt Lake19.0439603.218under
28King, Brian S.Summit19.8741329.618under
29Perry, Lee B.Box Elder13.1727393.619over
29Perry, Lee B.Weber16.5234361.619under
30Winder, MikeSalt Lake19.0439603.217under
31Weight, ElizabethSalt Lake19.0439603.224under
32Christensen, LaVarSalt Lake19.0439603.214under
33Hall, CraigSalt Lake19.0439603.233under
34Kwan, KarenSalt Lake19.0439603.228under
35Wheatley, Mark A.Salt Lake19.0439603.236under
36Arent, Patrice M.Salt Lake19.0439603.218under
37Moss, Carol SpackmanSalt Lake19.0439603.225under
38Hutchings, Eric K.Salt Lake19.0439603.215under
39Dunnigan, James A.Salt Lake19.0439603.217under
40Hemingway, Lynn N.Salt Lake19.0439603.224under
41McCay, DanielSalt Lake19.0439603.210under
42Coleman, Kim F.Salt Lake19.0439603.29under
43Acton, Cheryl K.Salt Lake19.0439603.217under
44Cutler, Bruce R.Salt Lake19.0439603.225under
45Eliason, SteveSalt Lake19.0439603.218under
46Poulson, Marie H.Salt Lake19.0439603.216under
47Ivory, KenSalt Lake19.0439603.220under
48Stratton, Keven J.Utah15.7332718.423under
49Spendlove, Robert M.Salt Lake19.0439603.211under
50Pulsipher, SusanSalt Lake19.0439603.210under
51Hughes, Gregory H.Salt Lake19.0439603.211under
52Knotwell, JohnSalt Lake19.0439603.27under
53Wilde, LoganDaggett15.8833030.418under
53Wilde, LoganDuchesne14.5430243.218under
53Wilde, LoganMorgan16.5234361.618under
53Wilde, LoganRich16.5634444.818under
53Wilde, LoganSummit19.8741329.618under
54Quinn, TimSummit19.8741329.618under
54Quinn, TimWasatch17.8737169.618under
55Chew, Scott H.Duchesne14.5430243.220under
55Chew, Scott H.Uintah16.1533592.020under
56Christofferson, Kay J.Utah15.7332718.415under
57Greene, Brian M.Utah15.7332718.416under
58Owens, Derrin R.Juab15.7332718.430under
58Owens, Derrin R.Sanpete12.5026000.030over
59Peterson, Val L.Utah15.7332718.422under
60Daw, Brad M.Utah15.7332718.427under
61Grover, KeithUtah15.7332718.426under
62Stanard, Jon E.Washington15.8532968.024under
63EmptyUtah15.7332718.454under
64Thurston, Norman KUtah15.7332718.438under
65Gibson, Francis D.Utah15.7332718.418under
66McKell, Michael K.Utah15.7332718.413under
67Roberts, Marc K.Utah15.7332718.418under
68Nelson, Merrill F.Beaver12.5026000.023over
68Nelson, Merrill F.Juab15.7332718.423under
68Nelson, Merrill F.Millard12.5026000.023over
68Nelson, Merrill F.Tooele15.4032032.023under
68Nelson, Merrill F.Utah15.7332718.423under
69Watkins, Christine FCarbon12.5026000.033over
69Watkins, Christine FDuchesne14.5430243.233under
69Watkins, Christine FEmery12.5026000.033over
69Watkins, Christine FGrand15.6332510.433under
70Albrecht, Carl R.Emery12.5026000.029over
70Albrecht, Carl R.Grand15.6332510.429under
70Albrecht, Carl R.Sanpete12.5026000.029over
70Albrecht, Carl R.Sevier12.5026000.029over
71Last, Bradley G.Iron12.5026000.027over
71Last, Bradley G.Washington15.8532968.027under
72Westwood, John R.Iron12.5026000.034over
73Noel, Michael E.Beaver12.5026000.033over
73Noel, Michael E.Garfield12.5026000.033over
73Noel, Michael E.Kane15.7932843.233under
73Noel, Michael E.Piute15.6932635.233under
73Noel, Michael E.San Juan12.5026000.033over
73Noel, Michael E.Sevier12.5026000.033over
73Noel, Michael E.Wayne12.5026000.033over
74Snow, V. LowryWashington15.8532968.022under
75Brooks, WaltWashington15.8532968.029under

make a prettier final table of Senate data.

kable(senate_j2)
DistrictSenatorCountyhw_hourhw_year%district<30K/yrestimate
1Escamilla, Luz (D)Salt Lake19.0439603.229under
2Dabakis, Jim (D)Salt Lake19.0439603.237under
3Davis, Gene (D)Salt Lake19.0439603.232under
4Iwamoto, Jani (D)Salt Lake19.0439603.218under
5Mayne, Karen (D)Salt Lake19.0439603.224under
6Harper, Wayne A. (R)Salt Lake19.0439603.217under
7Henderson, Deidre M. (R)Utah15.7332718.418under
8VacantSalt Lake19.0439603.223under
9Niederhauser, Wayne L. (R)Salt Lake19.0439603.214under
10Fillmore, Lincoln (R)Salt Lake19.0439603.29under
11Stephenson, Howard A. (R)Salt Lake19.0439603.210under
11Stephenson, Howard A. (R)Utah15.7332718.410under
12Thatcher, Daniel W. (R)Salt Lake19.0439603.217under
12Thatcher, Daniel W. (R)Tooele15.4032032.017under
13Anderegg, Jacob L. (R)Salt Lake19.0439603.211under
13Anderegg, Jacob L. (R)Utah15.7332718.411under
14Hemmert, Daniel (R)Utah15.7332718.413under
15Dayton, Margaret (R)Utah15.7332718.426under
16Bramble, Curtis S. (R)Utah15.7332718.440under
16Bramble, Curtis S. (R)Wasatch17.8737169.640under
17Knudson, Peter C. (R)Box Elder13.1727393.618over
17Knudson, Peter C. (R)Cache13.1027248.018over
17Knudson, Peter C. (R)Tooele15.4032032.018under
18Millner, Ann (R)Davis16.5234361.627under
18Millner, Ann (R)Morgan16.5234361.627under
18Millner, Ann (R)Weber16.5234361.627under
19Christensen, Allen M. (R)Morgan16.5234361.622under
19Christensen, Allen M. (R)Summit19.8741329.622under
19Christensen, Allen M. (R)Weber16.5234361.622under
20Buxton, David G. (R)Davis16.5234361.617under
20Buxton, David G. (R)Weber16.5234361.617under
21Stevenson, Jerry W. (R)Davis16.5234361.617under
22Adams, J. Stuart (R)Davis16.5234361.613under
23Weiler, Todd (R)Davis16.5234361.618under
23Weiler, Todd (R)Salt Lake19.0439603.218under
24Okerlund, Ralph (R)Beaver12.5026000.030over
24Okerlund, Ralph (R)Garfield12.5026000.030over
24Okerlund, Ralph (R)Juab15.7332718.430under
24Okerlund, Ralph (R)Kane15.7932843.230under
24Okerlund, Ralph (R)Millard12.5026000.030over
24Okerlund, Ralph (R)Piute15.6932635.230under
24Okerlund, Ralph (R)Sanpete12.5026000.030over
24Okerlund, Ralph (R)Sevier12.5026000.030over
24Okerlund, Ralph (R)Utah15.7332718.430under
24Okerlund, Ralph (R)Wayne12.5026000.030over
25Hillyard, Lyle W. (R)Cache13.1027248.031over
25Hillyard, Lyle W. (R)Rich16.5634444.831under
26Van Tassell, Kevin T. (R)Daggett15.8833030.421under
26Van Tassell, Kevin T. (R)Duchesne14.5430243.221under
26Van Tassell, Kevin T. (R)Summit19.8741329.621under
26Van Tassell, Kevin T. (R)Uintah16.1533592.021under
26Van Tassell, Kevin T. (R)Wasatch17.8737169.621under
27Hinkins, David P. (R)Carbon12.5026000.029over
27Hinkins, David P. (R)Emery12.5026000.029over
27Hinkins, David P. (R)Grand15.6332510.429under
27Hinkins, David P. (R)San Juan12.5026000.029over
27Hinkins, David P. (R)Utah15.7332718.429under
27Hinkins, David P. (R)Wasatch17.8737169.629under
28Vickers, Evan J. (R)Beaver12.5026000.030over
28Vickers, Evan J. (R)Iron12.5026000.030over
28Vickers, Evan J. (R)Washington15.8532968.030under
29Ipson, Don L. (R)Washington15.8532968.026under