#Let’s set everything we need up :)

#The first map I want to create is a choropleth map of % change of average rent prices in Inglewood by cenus tract. Unfortunately we can’t pull census tracts by city, so we’re going to have to first pull everything for Los Angeles County.

#Now that we know that process works, let’s join all the years that used the 2020 census tracts

#Now I know census tracts changed between the 2010 ACS data and the 2020 ACS data. So now I wanna compare the two tracts that combined and see how similar they are. I know which census tracts they are based on overlaying two maps in QGIS.

#Now it’s time to single out the two tracks (with the GEOIDs 06037602004 and 06037600502) that were combined to be a new tract with the GEOID 06037604200. I want to make sure that the two tracts are similar enough before they were split, and I’ll use the more conservative one in my map. So lets pull them out!

#So based on this, the difference between the two tracts is within the margin of error until 2018 and 2019. Now it is time to join all my census data into one data set. One way is to combine the two tracts in the 2010s.

#But this is isn’t the only way I could do this. Averaging the rents between the two combined tracts is risky because I don’t have data to weight by the number of rental units in each tract. Therefore I could also do it by just using the more conservative tract, with GEOID 06037600502. Here is how that would look

#Next I’m gonna turn that data set FINALLY into one that is measuring percent change. We’re gonna go with the no average method for now.

#Now I’ll export it into a csv so I can make a map with it in QGIS

#So I’m back from putting it in QGIS. Unfortunately one of the census tracts we need (GEOID: 0603760073) is missing data from 2010, so we’re gonna do some tweaking and make a new csv

#Great, that allowed us to create a beautiful map. And now that we know which census tracts are in Inglewood, we can use all the data to do some cool math and find out more specific info

## [1] 65.79277
## [1] 64.08806
## [1] 7.459744
## [1] 54.41304
## [1] 6.607364
## [1] 50.96622

#I’m just gonna make some tweaks and some downloads for myself to make some charts in data wrapper

#Cool! Now that I’ve made my map in QGIS, I also wanna see what it would look like in R

## Reading layer `Inglewoodcensustracts' from data source 
##   `/Users/summermaxwell/Desktop/J221/R/R data/Inglewoodcensustracts.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 26 features and 73 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -118.3788 ymin: 33.92533 xmax: -118.3177 ymax: 33.9819
## Geodetic CRS:  NAD83
## Simple feature collection with 26 features and 73 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -118.3788 ymin: 33.92533 xmax: -118.3177 ymax: 33.9819
## Geodetic CRS:  NAD83
## First 10 features:
##    STATEFP COUNTYFP TRACTCE       GEOID              GEOIDFQ    NAME
## 1       06      037  602003 06037602003 1400000US06037602003 6020.03
## 2       06      037  601801 06037601801 1400000US06037601801 6018.01
## 3       06      037  601402 06037601402 1400000US06037601402 6014.02
## 4       06      037  601202 06037601202 1400000US06037601202 6012.02
## 5       06      037  604200 06037604200 1400000US06037604200    6042
## 6       06      037  601303 06037601303 1400000US06037601303 6013.03
## 7       06      037  601002 06037601002 1400000US06037601002 6010.02
## 8       06      037  600501 06037600501 1400000US06037600501 6005.01
## 9       06      037  600601 06037600601 1400000US06037600601 6006.01
## 10      06      037  600602 06037600602 1400000US06037600602 6006.02
##                NAMELSAD MTFCC FUNCSTAT   ALAND AWATER    INTPTLAT     INTPTLON
## 1  Census Tract 6020.03 G5020        S  625132      0 +33.9343496 -118.3393882
## 2  Census Tract 6018.01 G5020        S  486723      0 +33.9436357 -118.3504258
## 3  Census Tract 6014.02 G5020        S  983308      0 +33.9509443 -118.3657334
## 4  Census Tract 6012.02 G5020        S  654269      0 +33.9490727 -118.3569389
## 5     Census Tract 6042 G5020        S 1256332      0 +33.9312090 -118.3307250
## 6  Census Tract 6013.03 G5020        S  438449      0 +33.9741892 -118.3617818
## 7  Census Tract 6010.02 G5020        S  633250      0 +33.9565607 -118.3475932
## 8  Census Tract 6005.01 G5020        S  657076      0 +33.9345323 -118.3220565
## 9  Census Tract 6006.01 G5020        S  646831      0 +33.9418498 -118.3220544
## 10 Census Tract 6006.02 G5020        S  690276      0 +33.9416202 -118.3307594
##    larent_pct larent_p_1 larent_p_2 larent_p_3 larent_p_4 larent_p_5 larent_p_6
## 1        1023       1035       1076       1095       1150       1132       1200
## 2         991       1068       1050       1054       1088       1086       1058
## 3         896        947        987        945       1044       1193       1185
## 4         889        940        998       1040       1013       1000       1048
## 5      1028.5     1081.5       1277     1347.5       1320       1281       1296
## 6        1001       1063       1085       1102       1097       1134       1163
## 7         972        972       1002       1065       1069       1087       1138
## 8         970       1051       1041       1113       1125       1122       1113
## 9         998       1024       1179       1260       1205       1275       1309
## 10        968       1003       1012       1082       1098       1063       1117
##    larent_p_7 larent_p_8 larent_p_9 larent_p10 larent_p11 larent_p12 larent_p13
## 1        1249       1369       1491         77         83         83         99
## 2        1117       1130       1122        120        280        239        185
## 3        1228       1274       1331         75         77        115         85
## 4        1114       1196       1241         46         67        135        168
## 5        1277     1412.5     1419.5      241.5        255        177      124.5
## 6        1264       1360       1438         61         77         91        103
## 7        1135       1252       1437         62         46         58         76
## 8        1152       1280       1393        134        129        200        272
## 9        1416       1435       1570        139        137        243        157
## 10       1184       1198       1292         47         66         59         52
##    larent_p14 larent_p15 larent_p16 larent_p17 larent_p18 larent_p19
## 1          77         67         89        112        140        124
## 2          88         92         83         64         54         69
## 3         165        161        225        272        148        116
## 4         118        144        177        124        142        174
## 5         115      106.5      118.5      148.5      152.5        162
## 6          58         59         61         63         46         70
## 7          79         74         93        114        168        245
## 8          85         88         60         76         90         43
## 9          82         83         76        147        189        176
## 10         52         48         42         69         59         66
##                                              larent_p20 larent_p21 larent_p22
## 1  Census Tract 6020.03; Los Angeles County; California       1808       1718
## 2  Census Tract 6018.01; Los Angeles County; California       1679       1519
## 3  Census Tract 6014.02; Los Angeles County; California       1622       1467
## 4  Census Tract 6012.02; Los Angeles County; California       1854       1716
## 5     Census Tract 6042; Los Angeles County; California       1703       1712
## 6  Census Tract 6013.03; Los Angeles County; California       1776       1752
## 7  Census Tract 6010.02; Los Angeles County; California       1740       1627
## 8  Census Tract 6005.01; Los Angeles County; California       1722       1643
## 9  Census Tract 6006.01; Los Angeles County; California       1820       1791
## 10 Census Tract 6006.02; Los Angeles County; California       1750       1620
##    larent_p23 larent_p24 larent_p25 larent_p26 larent_p27 larent_p28 larent_p29
## 1        1629       1599        209        162        133        104   76.73509
## 2        1412       1245        145        196        190        131   69.42482
## 3        1352       1338        222        204        115         79   81.02679
## 4        1613       1373        442        255        266        276  108.54893
## 5        1440       1510        222        167        260        296   65.58094
## 6        1590       1499         81         86        123        108   77.42258
## 7        1514       1342        297        163        316        251   79.01235
## 8        1466       1431         89        128        126         58   77.52577
## 9        1742       1663        185        141        128        147   82.36473
## 10       1417       1323        108        126         57         75   80.78512
##    final_rent final_re_1 final_re_2 final_re_3 final_re_4 final_re_5 final_re_6
## 1        1023       1035       1076       1095       1150       1132       1200
## 2         991       1068       1050       1054       1088       1086       1058
## 3         896        947        987        945       1044       1193       1185
## 4         889        940        998       1040       1013       1000       1048
## 5      1028.5     1081.5       1277     1347.5       1320       1281       1296
## 6        1001       1063       1085       1102       1097       1134       1163
## 7         972        972       1002       1065       1069       1087       1138
## 8         970       1051       1041       1113       1125       1122       1113
## 9         998       1024       1179       1260       1205       1275       1309
## 10        968       1003       1012       1082       1098       1063       1117
##    final_re_7 final_re_8 final_re_9 final_re10 final_re11 final_re12 final_re13
## 1        1249       1369       1491         77         83         83         99
## 2        1117       1130       1122        120        280        239        185
## 3        1228       1274       1331         75         77        115         85
## 4        1114       1196       1241         46         67        135        168
## 5        1277     1412.5     1419.5      241.5        255        177      124.5
## 6        1264       1360       1438         61         77         91        103
## 7        1135       1252       1437         62         46         58         76
## 8        1152       1280       1393        134        129        200        272
## 9        1416       1435       1570        139        137        243        157
## 10       1184       1198       1292         47         66         59         52
##    final_re14 final_re15 final_re16 final_re17 final_re18 final_re19
## 1          77         67         89        112        140        124
## 2          88         92         83         64         54         69
## 3         165        161        225        272        148        116
## 4         118        144        177        124        142        174
## 5         115      106.5      118.5      148.5      152.5        162
## 6          58         59         61         63         46         70
## 7          79         74         93        114        168        245
## 8          85         88         60         76         90         43
## 9          82         83         76        147        189        176
## 10         52         48         42         69         59         66
##                                              final_re20 final_re21 final_re22
## 1  Census Tract 6020.03; Los Angeles County; California       1808       1718
## 2  Census Tract 6018.01; Los Angeles County; California       1679       1519
## 3  Census Tract 6014.02; Los Angeles County; California       1622       1467
## 4  Census Tract 6012.02; Los Angeles County; California       1854       1716
## 5     Census Tract 6042; Los Angeles County; California       1703       1712
## 6  Census Tract 6013.03; Los Angeles County; California       1776       1752
## 7  Census Tract 6010.02; Los Angeles County; California       1740       1627
## 8  Census Tract 6005.01; Los Angeles County; California       1722       1643
## 9  Census Tract 6006.01; Los Angeles County; California       1820       1791
## 10 Census Tract 6006.02; Los Angeles County; California       1750       1620
##    final_re23 final_re24 final_re25 final_re26 final_re27 final_re28 final_re29
## 1        1629       1599        209        162        133        104   74.68599
## 2        1412       1245        145        196        190        131   57.20974
## 3        1352       1338        222        204        115         79   71.27772
## 4        1613       1373        442        255        266        276   97.23404
## 5        1440       1510        222        167        260        296   57.46648
## 6        1590       1499         81         86        123        108   67.07432
## 7        1514       1342        297        163        316        251   79.01235
## 8        1466       1431         89        128        126         58   63.84396
## 9        1742       1663        185        141        128        147   77.73438
## 10       1417       1323        108        126         57         75   74.47657
##                          geometry
## 1  POLYGON ((-118.3439 33.9358...
## 2  POLYGON ((-118.357 33.9426,...
## 3  POLYGON ((-118.3701 33.9563...
## 4  POLYGON ((-118.3615 33.9527...
## 5  POLYGON ((-118.3374 33.9279...
## 6  POLYGON ((-118.3668 33.9770...
## 7  POLYGON ((-118.3526 33.9531...
## 8  POLYGON ((-118.3264 33.9329...
## 9  POLYGON ((-118.3264 33.9387...
## 10 POLYGON ((-118.3352 33.9410...
## Simple feature collection with 6 features and 73 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -118.3701 ymin: 33.92533 xmax: -118.3222 ymax: 33.97702
## Geodetic CRS:  NAD83
##   STATEFP COUNTYFP TRACTCE       GEOID              GEOIDFQ    NAME
## 1      06      037  602003 06037602003 1400000US06037602003 6020.03
## 2      06      037  601801 06037601801 1400000US06037601801 6018.01
## 3      06      037  601402 06037601402 1400000US06037601402 6014.02
## 4      06      037  601202 06037601202 1400000US06037601202 6012.02
## 5      06      037  604200 06037604200 1400000US06037604200    6042
## 6      06      037  601303 06037601303 1400000US06037601303 6013.03
##               NAMELSAD MTFCC FUNCSTAT   ALAND AWATER    INTPTLAT     INTPTLON
## 1 Census Tract 6020.03 G5020        S  625132      0 +33.9343496 -118.3393882
## 2 Census Tract 6018.01 G5020        S  486723      0 +33.9436357 -118.3504258
## 3 Census Tract 6014.02 G5020        S  983308      0 +33.9509443 -118.3657334
## 4 Census Tract 6012.02 G5020        S  654269      0 +33.9490727 -118.3569389
## 5    Census Tract 6042 G5020        S 1256332      0 +33.9312090 -118.3307250
## 6 Census Tract 6013.03 G5020        S  438449      0 +33.9741892 -118.3617818
##   larent_pct larent_p_1 larent_p_2 larent_p_3 larent_p_4 larent_p_5 larent_p_6
## 1       1023       1035       1076       1095       1150       1132       1200
## 2        991       1068       1050       1054       1088       1086       1058
## 3        896        947        987        945       1044       1193       1185
## 4        889        940        998       1040       1013       1000       1048
## 5     1028.5     1081.5       1277     1347.5       1320       1281       1296
## 6       1001       1063       1085       1102       1097       1134       1163
##   larent_p_7 larent_p_8 larent_p_9 larent_p10 larent_p11 larent_p12 larent_p13
## 1       1249       1369       1491         77         83         83         99
## 2       1117       1130       1122        120        280        239        185
## 3       1228       1274       1331         75         77        115         85
## 4       1114       1196       1241         46         67        135        168
## 5       1277     1412.5     1419.5      241.5        255        177      124.5
## 6       1264       1360       1438         61         77         91        103
##   larent_p14 larent_p15 larent_p16 larent_p17 larent_p18 larent_p19
## 1         77         67         89        112        140        124
## 2         88         92         83         64         54         69
## 3        165        161        225        272        148        116
## 4        118        144        177        124        142        174
## 5        115      106.5      118.5      148.5      152.5        162
## 6         58         59         61         63         46         70
##                                             larent_p20 larent_p21 larent_p22
## 1 Census Tract 6020.03; Los Angeles County; California       1808       1718
## 2 Census Tract 6018.01; Los Angeles County; California       1679       1519
## 3 Census Tract 6014.02; Los Angeles County; California       1622       1467
## 4 Census Tract 6012.02; Los Angeles County; California       1854       1716
## 5    Census Tract 6042; Los Angeles County; California       1703       1712
## 6 Census Tract 6013.03; Los Angeles County; California       1776       1752
##   larent_p23 larent_p24 larent_p25 larent_p26 larent_p27 larent_p28 larent_p29
## 1       1629       1599        209        162        133        104   76.73509
## 2       1412       1245        145        196        190        131   69.42482
## 3       1352       1338        222        204        115         79   81.02679
## 4       1613       1373        442        255        266        276  108.54893
## 5       1440       1510        222        167        260        296   65.58094
## 6       1590       1499         81         86        123        108   77.42258
##   final_rent final_re_1 final_re_2 final_re_3 final_re_4 final_re_5 final_re_6
## 1       1023       1035       1076       1095       1150       1132       1200
## 2        991       1068       1050       1054       1088       1086       1058
## 3        896        947        987        945       1044       1193       1185
## 4        889        940        998       1040       1013       1000       1048
## 5     1028.5     1081.5       1277     1347.5       1320       1281       1296
## 6       1001       1063       1085       1102       1097       1134       1163
##   final_re_7 final_re_8 final_re_9 final_re10 final_re11 final_re12 final_re13
## 1       1249       1369       1491         77         83         83         99
## 2       1117       1130       1122        120        280        239        185
## 3       1228       1274       1331         75         77        115         85
## 4       1114       1196       1241         46         67        135        168
## 5       1277     1412.5     1419.5      241.5        255        177      124.5
## 6       1264       1360       1438         61         77         91        103
##   final_re14 final_re15 final_re16 final_re17 final_re18 final_re19
## 1         77         67         89        112        140        124
## 2         88         92         83         64         54         69
## 3        165        161        225        272        148        116
## 4        118        144        177        124        142        174
## 5        115      106.5      118.5      148.5      152.5        162
## 6         58         59         61         63         46         70
##                                             final_re20 final_re21 final_re22
## 1 Census Tract 6020.03; Los Angeles County; California       1808       1718
## 2 Census Tract 6018.01; Los Angeles County; California       1679       1519
## 3 Census Tract 6014.02; Los Angeles County; California       1622       1467
## 4 Census Tract 6012.02; Los Angeles County; California       1854       1716
## 5    Census Tract 6042; Los Angeles County; California       1703       1712
## 6 Census Tract 6013.03; Los Angeles County; California       1776       1752
##   final_re23 final_re24 final_re25 final_re26 final_re27 final_re28 final_re29
## 1       1629       1599        209        162        133        104   74.68599
## 2       1412       1245        145        196        190        131   57.20974
## 3       1352       1338        222        204        115         79   71.27772
## 4       1613       1373        442        255        266        276   97.23404
## 5       1440       1510        222        167        260        296   57.46648
## 6       1590       1499         81         86        123        108   67.07432
##                         geometry
## 1 POLYGON ((-118.3439 33.9358...
## 2 POLYGON ((-118.357 33.9426,...
## 3 POLYGON ((-118.3701 33.9563...
## 4 POLYGON ((-118.3615 33.9527...
## 5 POLYGON ((-118.3374 33.9279...
## 6 POLYGON ((-118.3668 33.9770...

#Now let’s make another, simpler map, just showing the raw gross median rent in Inglewood in 2023

#Now let’s do the same for 2011