Setup

Load Data

# Load the Dorling San Diego GeoJSON dataset
sd <- st_read("Dorling_SanDiego.geojson")
## Reading layer `Dorling_SanDiego' from data source 
##   `/Users/rohithsrinivasa/Downloads/Dorling_SanDiego.geojson' 
##   using driver `GeoJSON'
## Simple feature collection with 534 features and 186 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -117.4255 ymin: 32.54299 xmax: -116.6098 ymax: 33.44861
## Geodetic CRS:  WGS 84
glimpse(sd)
## Rows: 534
## Columns: 187
## $ GEOID      <chr> "6073000100", "6073000201", "6073000202", "6073000400", "60…
## $ POP        <dbl> 3027, 2294, 3919, 3802, 2934, 3144, 4631, 5257, 4545, 3054,…
## $ statea     <chr> "06", "06", "06", "06", "06", "06", "06", "06", "06", "06",…
## $ countya    <chr> "073", "073", "073", "073", "073", "073", "073", "073", "07…
## $ tracta     <chr> "000100", "000201", "000202", "000400", "000500", "000600",…
## $ pnhwht12   <dbl> 87.43, 85.65, 84.81, 65.73, 70.52, 74.24, 73.29, 59.06, 60.…
## $ pnhblk12   <dbl> 0.00, 0.00, 0.84, 5.17, 4.70, 3.00, 2.57, 12.13, 4.94, 5.12…
## $ phisp12    <dbl> 11.99, 10.30, 9.74, 12.04, 13.11, 12.06, 13.69, 18.04, 24.2…
## $ pntv12     <dbl> 0.00, 0.00, 0.00, 0.19, 0.93, 0.00, 0.41, 0.30, 0.00, 0.00,…
## $ pasian12   <dbl> 0.45, 2.26, 4.61, 12.18, 5.64, 7.82, 8.71, 6.53, 4.77, 1.95…
## $ phaw12     <dbl> 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,…
## $ pindia12   <dbl> 0.00, 0.00, 1.07, 0.67, 0.00, 0.00, 2.38, 0.28, 0.26, 0.00,…
## $ pchina12   <dbl> 0.38, 1.89, 2.21, 5.23, 0.36, 2.34, 3.62, 1.31, 1.64, 0.25,…
## $ pfilip12   <dbl> 0.07, 0.37, 0.26, 2.95, 0.90, 3.58, 1.73, 1.84, 0.26, 0.97,…
## $ pjapan12   <dbl> 0.00, 0.00, 0.00, 0.00, 1.97, 0.33, 0.99, 0.00, 0.00, 0.69,…
## $ pkorea12   <dbl> 0.00, 0.00, 0.40, 0.47, 0.29, 0.26, 0.00, 0.63, 0.62, 0.00,…
## $ pviet12    <dbl> 0.00, 0.00, 0.00, 3.06, 1.26, 0.44, 0.00, 0.00, 1.76, 0.00,…
## $ p15wht12   <dbl> 16.37, 10.37, 8.74, 2.45, 4.89, 3.35, 5.68, 2.52, 7.55, 8.4…
## $ p65wht12   <dbl> 23.50, 18.97, 14.37, 10.45, 8.50, 14.86, 12.67, 14.57, 6.42…
## $ p15blk12   <dbl> 18.75882, 0.00000, 0.00000, 0.00000, 8.40000, 0.00000, 0.00…
## $ p65blk12   <dbl> 10.08296, 0.00000, 0.00000, 5.91000, 0.00000, 0.00000, 0.00…
## $ p15hsp12   <dbl> 21.14, 6.12, 9.09, 8.55, 9.86, 12.12, 4.80, 10.91, 16.04, 2…
## $ p65hsp12   <dbl> 14.00, 0.00, 14.59, 8.78, 21.92, 17.58, 22.80, 5.03, 3.66, …
## $ p15ntv12   <dbl> 13.60773, 13.60773, 13.60773, 0.00000, 0.00000, 13.60773, 0…
## $ p65ntv12   <dbl> 11.37886, 11.37886, 11.37886, 20.00000, 0.00000, 11.37886, …
## $ p15asn12   <dbl> 0.00, 0.00, 15.15, 0.00, 0.00, 5.31, 4.09, 5.50, 5.93, 0.00…
## $ p65asn12   <dbl> 15.38, 16.28, 6.57, 3.07, 29.30, 15.93, 9.75, 6.87, 6.72, 1…
## $ pmex12     <dbl> 9.97, 6.62, 5.71, 9.76, 7.86, 7.78, 7.23, 16.50, 19.38, 34.…
## $ pcuban12   <dbl> 0.27, 0.00, 0.42, 0.00, 0.00, 0.00, 0.88, 0.00, 0.00, 0.00,…
## $ ppr12      <dbl> 0.00, 2.52, 0.00, 1.14, 0.86, 1.10, 0.00, 0.00, 0.00, 0.00,…
## $ pruanc12   <dbl> 0.58, 0.16, 2.07, 2.81, 4.13, 1.50, 1.62, 0.61, 0.83, 1.07,…
## $ pitanc12   <dbl> 4.90, 5.10, 9.23, 6.54, 4.49, 4.90, 2.96, 3.48, 3.93, 4.53,…
## $ pgeanc12   <dbl> 13.15, 9.88, 9.27, 7.84, 13.93, 9.28, 8.87, 7.34, 8.44, 10.…
## $ piranc12   <dbl> 7.81, 13.62, 13.96, 5.42, 7.29, 7.34, 6.05, 6.23, 10.10, 3.…
## $ pscanc12   <dbl> 2.50, 1.95, 2.40, 3.23, 4.34, 0.95, 5.45, 3.18, 5.04, 3.39,…
## $ pfb12      <dbl> 12.71, 17.51, 9.60, 22.36, 12.64, 10.92, 12.22, 22.91, 11.0…
## $ pnat12     <dbl> 9.25, 13.77, 3.26, 13.71, 7.72, 5.74, 9.89, 9.28, 4.40, 7.3…
## $ p10imm12   <dbl> 1.54, 1.31, 4.05, 7.18, 1.54, 3.62, 2.82, 8.58, 3.38, 6.22,…
## $ prufb12    <dbl> 0.00, 0.00, 0.00, 0.00, 0.00, 0.26, 1.53, 0.28, 0.19, 0.00,…
## $ pitfb12    <dbl> 0.41, 0.00, 0.72, 0.22, 0.00, 0.69, 0.00, 0.00, 0.00, 0.00,…
## $ pgefb12    <dbl> 0.00, 0.89, 1.72, 0.00, 2.23, 0.00, 0.36, 1.16, 0.00, 0.22,…
## $ pirfb12    <dbl> 0.00, 3.05, 0.00, 0.00, 0.00, 0.00, 0.00, 0.28, 0.00, 0.00,…
## $ pscfb12    <dbl> 0.14, 0.00, 0.00, 0.00, 0.00, 0.00, 0.19, 0.00, 0.00, 0.22,…
## $ polang12   <dbl> 21.86, 24.11, 18.01, 19.09, 18.94, 18.59, 19.76, 29.33, 20.…
## $ plep12     <dbl> 1.34, 1.76, 1.19, 1.00, 3.45, 2.58, 1.26, 7.26, 4.76, 8.97,…
## $ phs12      <dbl> 16.53, 14.80, 12.04, 10.04, 15.46, 15.15, 11.35, 24.14, 23.…
## $ pcol12     <dbl> 64.38, 55.73, 63.55, 57.96, 51.13, 66.15, 59.82, 50.00, 41.…
## $ punemp12   <dbl> 8.62, 7.46, 4.76, 6.62, 9.49, 6.16, 4.63, 14.56, 8.68, 12.3…
## $ pflabf12   <dbl> 49.02, 68.29, 68.27, 76.07, 82.75, 74.34, 65.05, 72.44, 77.…
## $ pprof12    <dbl> 66.97, 66.10, 52.93, 71.62, 58.71, 63.00, 53.69, 52.81, 41.…
## $ pmanuf12   <dbl> 1.72, 2.35, 3.74, 8.27, 5.97, 5.12, 9.83, 5.71, 6.30, 6.86,…
## $ psemp12    <dbl> 39.02, 24.43, 18.40, 4.32, 11.56, 11.88, 10.39, 11.07, 6.69…
## $ pvet12     <dbl> 12.89, 7.96, 10.00, 7.57, 8.31, 12.49, 10.45, 12.94, 7.18, …
## $ p65pov12   <dbl> 0.99, 3.47, 0.64, 2.16, 0.36, 3.36, 1.04, 0.25, 0.65, 0.94,…
## $ ppov12     <dbl> 3.40, 3.94, 5.29, 16.60, 7.79, 11.80, 10.57, 14.78, 14.89, …
## $ pwpov12    <dbl> 3.80, 4.60, 4.49, 20.93, 7.28, 11.91, 12.18, 14.22, 10.60, …
## $ pnapov12   <dbl> 22.60183, 22.60183, 22.60183, 57.14000, 0.00000, 22.60183, …
## $ pfmpov12   <dbl> 1.43, 0.00, 0.00, 9.50, 0.00, 0.00, 3.15, 4.70, 4.50, 16.06…
## $ pbpov12    <dbl> 25.50688, 0.00000, 0.00000, 0.00000, 0.00000, 25.61000, 0.0…
## $ phpov12    <dbl> 0.57, 0.00, 15.50, 8.31, 4.66, 4.55, 9.40, 18.46, 28.38, 32…
## $ papov12    <dbl> 0.00, 0.00, 0.00, 3.73, 28.03, 19.91, 0.00, 4.47, 10.64, 1.…
## $ pvac12     <dbl> 11.74, 3.92, 6.01, 2.48, 7.76, 10.13, 9.92, 9.36, 2.47, 9.2…
## $ pown12     <dbl> 87.35, 46.97, 48.41, 16.78, 31.97, 31.61, 31.20, 29.73, 16.…
## $ pmulti12   <dbl> 9.25, 43.40, 50.45, 91.05, 53.53, 68.09, 70.88, 71.65, 68.9…
## $ p30old12   <dbl> 90.97, 79.06, 83.47, 62.48, 87.90, 61.20, 80.97, 64.62, 77.…
## $ p18und12   <dbl> 18.53, 11.51, 10.88, 3.23, 6.61, 5.77, 5.56, 7.52, 11.61, 1…
## $ p60up12    <dbl> 35.21, 22.08, 18.73, 13.46, 16.66, 19.51, 19.39, 18.21, 10.…
## $ p75up12    <dbl> 12.23, 9.62, 5.06, 4.62, 4.78, 8.73, 8.33, 4.34, 1.64, 2.39…
## $ pmar12     <dbl> 63.76, 33.93, 35.92, 15.74, 26.89, 18.20, 22.67, 26.39, 28.…
## $ pwds12     <dbl> 14.62, 15.51, 20.46, 14.20, 18.30, 22.09, 21.84, 17.58, 18.…
## $ pfhh12     <dbl> 1.78, 0.00, 14.04, 9.50, 9.57, 14.01, 0.00, 20.38, 19.90, 2…
## $ p10yrs12   <dbl> 40.45, 53.83, 76.16, 84.76, 82.23, 77.28, 78.45, 81.30, 83.…
## $ ageblk12   <dbl> 0, 24, 36, 186, 131, 82, 94, 520, 277, 163, 121, 273, 886, …
## $ agentv12   <dbl> 0, 0, 0, 35, 26, 0, 26, 25, 17, 27, 12, 13, 210, 0, 9, 0, 0…
## $ agewht12   <dbl> 2553, 1629, 3640, 2363, 1964, 2032, 2676, 2341, 3194, 1761,…
## $ agehsp12   <dbl> 350, 196, 418, 433, 365, 330, 500, 715, 1284, 1139, 538, 16…
## $ india12    <dbl> 0, 0, 46, 24, 0, 0, 87, 11, 14, 0, 9, 0, 7, 0, 7, 0, 23, 0,…
## $ filip12    <dbl> 2, 7, 11, 106, 25, 98, 63, 73, 14, 31, 69, 16, 24, 83, 11, …
## $ japan12    <dbl> 0, 0, 0, 0, 55, 9, 36, 0, 0, 22, 20, 35, 0, 12, 0, 0, 0, 0,…
## $ korea12    <dbl> 0, 0, 17, 17, 8, 7, 0, 25, 33, 0, 0, 0, 0, 103, 0, 29, 0, 4…
## $ viet12     <dbl> 0, 0, 0, 110, 35, 12, 0, 0, 93, 0, 6, 0, 132, 0, 7, 8, 12, …
## $ pop12      <dbl> 2920, 1902, 4292, 3595, 2785, 2737, 3651, 3964, 5299, 3182,…
## $ nhwht12    <dbl> 2553, 1629, 3640, 2363, 1964, 2032, 2676, 2341, 3194, 1761,…
## $ nhblk12    <dbl> 0, 0, 36, 186, 131, 82, 94, 481, 262, 163, 121, 273, 833, 3…
## $ ntv12      <dbl> 0, 0, 0, 7, 26, 0, 15, 12, 0, 0, 0, 0, 25, 0, 9, 0, 0, 39, …
## $ hisp12     <dbl> 350, 196, 418, 433, 365, 330, 500, 715, 1284, 1139, 538, 16…
## $ asian12    <dbl> 13, 43, 198, 438, 157, 214, 318, 259, 253, 62, 137, 155, 34…
## $ haw12      <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0…
## $ china12    <dbl> 11, 36, 95, 188, 10, 64, 132, 52, 87, 8, 15, 79, 179, 26, 6…
## $ a15wht12   <dbl> 418, 169, 318, 58, 96, 68, 152, 59, 241, 149, 89, 178, 48, …
## $ a65wht12   <dbl> 600, 309, 523, 247, 167, 302, 339, 341, 205, 123, 180, 262,…
## $ a15blk12   <dbl> 0, 0, 0, 0, 11, 0, 0, 77, 15, 56, 0, 0, 113, 14, 9, 27, 17,…
## $ a65blk12   <dbl> 0, 0, 0, 11, 0, 0, 0, 78, 0, 12, 0, 13, 30, 14, 0, 0, 13, 2…
## $ a15hsp12   <dbl> 74, 12, 38, 37, 36, 40, 24, 78, 206, 333, 129, 364, 876, 40…
## $ a65hsp12   <dbl> 49, 0, 61, 38, 80, 58, 114, 36, 47, 63, 0, 30, 117, 52, 28,…
## $ a15ntv12   <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 99, 0, 0, 0, 0, 0, 0, …
## $ a65ntv12   <dbl> 0, 0, 0, 7, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7…
## $ ageasn12   <dbl> 13, 43, 198, 456, 157, 226, 318, 291, 253, 62, 137, 155, 44…
## $ a15asn12   <dbl> 0, 0, 30, 0, 0, 12, 13, 16, 15, 0, 15, 15, 108, 42, 0, 0, 0…
## $ a65asn12   <dbl> 2, 7, 13, 14, 46, 36, 31, 20, 17, 7, 0, 14, 37, 1, 13, 17, …
## $ mex12      <dbl> 291, 126, 245, 351, 219, 213, 264, 654, 1027, 1087, 415, 15…
## $ pr12       <dbl> 0, 48, 0, 41, 24, 30, 0, 0, 0, 0, 13, 20, 0, 207, 0, 0, 0, …
## $ cuban12    <dbl> 8, 0, 18, 0, 0, 0, 32, 0, 0, 0, 0, 0, 53, 0, 15, 0, 9, 170,…
## $ geanc12    <dbl> 384, 188, 398, 282, 388, 254, 324, 291, 447, 339, 294, 350,…
## $ iranc12    <dbl> 228, 259, 599, 195, 203, 201, 221, 247, 535, 114, 157, 213,…
## $ itanc12    <dbl> 143, 97, 396, 235, 125, 134, 108, 138, 208, 144, 127, 155, …
## $ ruanc12    <dbl> 17, 3, 89, 101, 115, 41, 59, 24, 44, 34, 46, 0, 0, 131, 25,…
## $ fb12       <dbl> 371, 333, 412, 804, 352, 299, 446, 908, 583, 566, 205, 780,…
## $ nat12      <dbl> 270, 262, 140, 493, 215, 157, 361, 368, 233, 235, 95, 319, …
## $ itfb12     <dbl> 12, 0, 31, 8, 0, 19, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 6, 0, 0…
## $ rufb12     <dbl> 0, 0, 0, 0, 0, 7, 56, 11, 10, 0, 0, 0, 0, 0, 0, 0, 9, 12, 0…
## $ ag5up12    <dbl> 2767, 1817, 4125, 3500, 2724, 2673, 3568, 3900, 4933, 3022,…
## $ irfb12     <dbl> 0, 58, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0,…
## $ gefb12     <dbl> 0, 17, 74, 0, 62, 0, 13, 46, 0, 7, 8, 8, 16, 0, 0, 11, 9, 3…
## $ scanc12    <dbl> 73, 37, 103, 116, 121, 26, 199, 126, 267, 108, 50, 115, 64,…
## $ n10imm12   <dbl> 45, 25, 174, 258, 43, 99, 103, 340, 179, 198, 67, 241, 515,…
## $ olang12    <dbl> 605, 438, 743, 668, 516, 497, 705, 1144, 1015, 967, 309, 14…
## $ lep12      <dbl> 37, 32, 49, 35, 94, 69, 45, 283, 235, 271, 36, 255, 830, 22…
## $ scfb12     <dbl> 4, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 21, 0, 0, 0, 24, 0, 8, 0, …
## $ ag25up12   <dbl> 2263, 1439, 3671, 3228, 2355, 2396, 3101, 3268, 4334, 2368,…
## $ dfmpov12   <dbl> 841, 322, 876, 242, 439, 307, 445, 574, 955, 523, 475, 814,…
## $ hh12       <dbl> 1241, 1005, 2206, 2277, 1570, 1721, 2144, 2449, 2566, 1579,…
## $ hinc12     <dbl> 110078, 69179, 74670, 59616, 57447, 52813, 60625, 43125, 54…
## $ hincb12    <dbl> 49940.72, 49940.72, 49940.72, 58571.00, 73387.00, 24531.00,…
## $ hincw12    <dbl> 111484, 57875, 80878, 62635, 60573, 62045, 57484, 48507, 56…
## $ hinch12    <dbl> 55909, 99583, 35625, 54092, 47321, 68500, 60786, 41016, 510…
## $ incpc12    <dbl> 71660, 61122, 58551, 45106, 44138, 47030, 45744, 37040, 310…
## $ ag18cv12   <dbl> 2367, 1683, 3780, 3447, 2539, 2547, 3407, 3640, 4649, 2559,…
## $ vet12      <dbl> 305, 134, 378, 261, 211, 318, 356, 471, 334, 111, 338, 309,…
## $ empclf12   <dbl> 1220, 1236, 2592, 2456, 1894, 1835, 2330, 2312, 3363, 1823,…
## $ dpov12     <dbl> 2915, 1902, 4217, 3380, 2785, 2737, 3651, 3952, 5191, 3182,…
## $ npov12     <dbl> 99, 75, 223, 561, 217, 323, 386, 584, 773, 807, 446, 625, 1…
## $ dbpov12    <dbl> 0, 24, 36, 136, 131, 82, 94, 508, 266, 163, 121, 273, 886, …
## $ nbpov12    <dbl> 0, 0, 0, 0, 0, 21, 0, 92, 46, 11, 23, 151, 311, 96, 25, 8, …
## $ dnapov12   <dbl> 0, 0, 0, 28, 26, 0, 26, 25, 17, 27, 12, 13, 210, 0, 9, 0, 0…
## $ nnapov12   <dbl> 0, 0, 0, 16, 0, 0, 11, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 13, 0…
## $ dwpov12    <dbl> 2550, 1629, 3583, 2265, 1964, 2032, 2676, 2341, 3141, 1761,…
## $ nwpov12    <dbl> 97, 75, 161, 474, 143, 242, 326, 333, 333, 420, 257, 196, 3…
## $ dhpov12    <dbl> 350, 196, 400, 373, 365, 330, 500, 715, 1258, 1139, 538, 15…
## $ nhpov12    <dbl> 2, 0, 62, 31, 17, 15, 47, 132, 357, 369, 133, 260, 1287, 48…
## $ hhb12      <dbl> 0, 0, 17, 114, 78, 39, 38, 261, 124, 74, 93, 152, 374, 201,…
## $ hhw12      <dbl> 1131, 881, 1824, 1526, 1169, 1314, 1685, 1514, 1728, 1046, …
## $ hhh12      <dbl> 106, 58, 243, 217, 223, 172, 257, 492, 485, 383, 129, 508, …
## $ hs12       <dbl> 374, 213, 442, 324, 364, 363, 352, 789, 1032, 589, 273, 985…
## $ col12      <dbl> 1457, 802, 2333, 1871, 1204, 1585, 1855, 1634, 1784, 969, 1…
## $ clf12      <dbl> 1287, 1301, 2647, 2630, 2054, 1947, 2443, 2603, 3665, 2035,…
## $ unemp12    <dbl> 111, 97, 126, 174, 195, 120, 113, 379, 318, 252, 118, 182, …
## $ dflabf12   <dbl> 1224, 924, 1894, 1492, 1206, 1173, 1442, 1611, 2144, 1354, …
## $ flabf12    <dbl> 600, 631, 1293, 1135, 998, 872, 938, 1167, 1659, 1013, 1057…
## $ prof12     <dbl> 817, 817, 1372, 1759, 1112, 1156, 1251, 1221, 1407, 904, 10…
## $ manuf12    <dbl> 21, 29, 97, 203, 113, 94, 229, 132, 212, 125, 52, 130, 282,…
## $ semp12     <dbl> 476, 302, 477, 106, 219, 218, 242, 256, 225, 211, 209, 281,…
## $ hha12      <dbl> 0, 43, 122, 305, 53, 134, 136, 153, 98, 61, 57, 82, 141, 84…
## $ hinca12    <dbl> 79531.26, 111450.00, 92880.00, 75027.00, 51440.00, 33700.00…
## $ n65pov12   <dbl> 29, 66, 27, 73, 10, 92, 38, 10, 34, 30, 36, 38, 21, 41, 24,…
## $ nfmpov12   <dbl> 12, 0, 0, 23, 0, 0, 14, 27, 43, 84, 23, 63, 365, 81, 0, 12,…
## $ napov12    <dbl> 0, 0, 0, 17, 44, 45, 0, 13, 25, 1, 25, 16, 129, 52, 7, 29, …
## $ dapov12    <dbl> 11, 43, 198, 456, 157, 226, 318, 291, 235, 62, 137, 155, 44…
## $ family12   <dbl> 841, 322, 876, 242, 439, 307, 445, 574, 955, 523, 475, 814,…
## $ hu12       <dbl> 1406, 1046, 2347, 2335, 1702, 1915, 2380, 2702, 2631, 1740,…
## $ vac12      <dbl> 165, 41, 141, 58, 132, 194, 236, 253, 65, 161, 105, 190, 12…
## $ ohu12      <dbl> 1241, 1005, 2206, 2277, 1570, 1721, 2144, 2449, 2566, 1579,…
## $ own12      <dbl> 1084, 472, 1068, 382, 502, 544, 669, 728, 435, 410, 518, 66…
## $ rent12     <dbl> 157, 533, 1138, 1895, 1068, 1177, 1475, 1721, 2131, 1169, 9…
## $ dmulti12   <dbl> 1406, 1046, 2347, 2335, 1702, 1915, 2380, 2702, 2631, 1740,…
## $ mrent12    <dbl> 1869, 1061, 1327, 1029, 986, 988, 1068, 1013, 1018, 1006, 1…
## $ mhmval12.x <dbl> 948200, 758900, 587900, 364100, 679900, 396500, 470300, 426…
## $ multi12    <dbl> 130, 454, 1184, 2126, 911, 1304, 1687, 1936, 1815, 1183, 61…
## $ h30old12   <dbl> 1279, 827, 1959, 1459, 1496, 1172, 1927, 1746, 2038, 1429, …
## $ h10yrs12   <dbl> 502, 541, 1680, 1930, 1291, 1330, 1682, 1991, 2151, 1286, 1…
## $ a18und12   <dbl> 541, 219, 467, 116, 184, 158, 203, 298, 615, 597, 325, 748,…
## $ a60up12    <dbl> 1028, 420, 804, 484, 464, 534, 708, 722, 540, 276, 380, 499…
## $ a75up12    <dbl> 357, 183, 217, 166, 133, 239, 304, 172, 87, 76, 66, 139, 79…
## $ ag15up12   <dbl> 2428, 1721, 3906, 3500, 2629, 2621, 3462, 3755, 4721, 2635,…
## $ X12.Mar    <dbl> 1548, 584, 1403, 551, 707, 477, 785, 991, 1332, 764, 723, 1…
## $ wds12      <dbl> 355, 267, 799, 497, 481, 579, 756, 660, 865, 600, 511, 609,…
## $ fhh12      <dbl> 15, 0, 123, 23, 42, 43, 0, 117, 190, 123, 49, 109, 298, 120…
## $ pop.w      <dbl> 0.75675, 0.57350, 0.97975, 0.95050, 0.73350, 0.78600, 1.157…
## $ cluster    <chr> "4", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",…
## $ tractid    <chr> "fips-06-073-000100", "fips-06-073-000201", "fips-06-073-00…
## $ mhmval00   <dbl> 592020.2, 342000.0, 342000.0, 236400.0, 296400.0, 191400.0,…
## $ mhmval12.y <dbl> 948200, 758900, 587900, 364100, 679900, 396500, 470300, 426…
## $ mhv.00     <dbl> 762847.6, 440684.1, 440684.1, 304613.2, 381926.2, 246628.5,…
## $ mhv.10     <dbl> 948200, 758900, 587900, 364100, 679900, 396500, 470300, 426…
## $ mhv.change <dbl> 185352.37, 318215.90, 147215.90, 59486.78, 297973.78, 14987…
## $ mhv.growth <dbl> 24.29743, 72.20953, 33.40622, 19.52863, 78.01868, 60.76814,…
## $ geometry   <POLYGON [°]> POLYGON ((-117.1827 32.7530..., POLYGON ((-117.1706…

Notes:
- The dataset contains 534 features (tracts) in San Diego County
- Key variables include population, race/ethnicity percentages, home values (2000 & 2012), and cluster classifications


Basic Map

tmap_mode("plot")

tm_shape(sd) +
  tm_polygons(col = "gray50", alpha = 0.8) +
  tm_borders(col = "black", lwd = 0.3) +
  tm_layout(title = "Basic Map of San Diego Dorling Cartogram")


Choropleth Map: Median Home Value % Growth (2000–2012)

tm_shape(sd) +
  tm_polygons("mhv.growth", 
              palette = "YlOrRd",
              style = "quantile",
              border.col = "gray20",
              lwd = 0.2,
              scale = 1.5, # magnifies the circles
              title = "% Growth in Median Home Value") +
              tm_borders(col = "white") +
              tm_layout(title = "Change in Home Values (2000–2012)")

tmap_mode("view")

Interpretation:
The map shows substantial variation in the percent growth of median home values across San Diego County between 2000 and 2012. Tracts displayed in deeper orange and red experienced the fastest appreciation—often exceeding 50% growth—while lighter areas grew more modestly.

Because this is a Dorling cartogram, the spatial arrangement reflects approximate geographic relationships but emphasizes variation between census tracts. A few tracts show unusually high growth, which may signal neighborhoods undergoing rapid investment or early stages of gentrification. Conversely, areas with lower or even negative growth may correspond to communities with older housing stock, slower demand, or localized socioeconomic challenges.

These patterns may be driven by factors such as proximity to job centers, school quality, coastal access, infrastructure improvements, or broader housing market pressures during the early 2000s. Understanding where home values rose most quickly can help policymakers identify neighborhoods potentially at risk of displacement, evaluate housing affordability pressures, or target resources for equitable economic development.


Filtering: High-Growth Tracts (> 25%)

sd_high_growth <- sd %>% 
  filter(mhv.growth > 25)

tm_shape(sd_high_growth) +
  tm_polygons("mhv.growth", 
              palette = "Reds",
              style = "quantile",
              title = "% Home Value Growth") +
  tm_borders(col = "white") +
  tm_layout(title = "High-Growth Census Tracts (> 25%)")

Interpretation:
This filtered map isolates census tracts where median home values increased by more than 25% between 2000 and 2012. These high-growth areas tend to cluster in particular parts of the county, which suggests that appreciation is not evenly distributed across all neighborhoods. Many of the highlighted tracts show growth levels above 40–60%, indicating substantial increases in housing costs.

Such rapid appreciation may reflect strong demand, nearby amenities, or local redevelopment efforts, but it may also signal vulnerability to gentrification and displacement pressures. Identifying where home values are rising most quickly can help policymakers monitor affordability challenges, target housing interventions, and understand broader patterns of neighborhood change in San Diego County.


Faceted Map by Cluster

# Improve visibility of tiny Dorling polygons
tmap_options(
  outer.margins = c(0, 0, 0, 0),
  inner.margins = c(0.02, 0.02, 0.02, 0.02)
)

tm_facets_optimized <-
  tm_shape(sd) +
  tm_polygons(
    "mhv.growth",
    palette = "YlOrRd",
    style = "quantile",
    border.col = "gray30",
    lwd = 0.4,
    scale = 2.2
  ) +
  tm_facets(
    by = "cluster",
    ncol = 2,
    free.coords = FALSE
  ) +
  tm_layout(
    title = "Home Value Growth by Cluster (Optimized View)",
    frame = FALSE,
    legend.position = c("right", "center"),  # <-- works on all versions
    title.size = 1.2
  )

tm_facets_optimized

Interpretation:
The faceted cluster maps reveal strong differences in home value growth patterns across the six clusters of census tracts in San Diego County. Each cluster represents neighborhoods with shared demographic or socioeconomic characteristics, and viewing them side-by-side highlights how unevenly housing appreciation is distributed across the region.

Cluster 1 shows a scattered distribution of moderate growth, with many tracts on the lower end of the growth scale. This suggests relatively stable or slower-changing neighborhoods with limited market pressure.

Cluster 2 displays a large number of tracts with very high home value growth (deep red shades), particularly concentrated near central and coastal areas. This indicates that neighborhoods in this cluster experienced some of the strongest appreciation in the county, potentially signaling redevelopment pressures, increased demand, or early stages of gentrification.

Cluster 3 also shows a dense cluster of high-growth tracts, especially in more urbanized areas. This suggests that socioeconomic or demographic characteristics defining Cluster 3 may be linked to rapidly rising housing values and increased competition in the local housing market.

Cluster 4 exhibits a mix of moderate and high-growth tracts. While some tracts show substantial growth, others remain closer to mid-range values. This mixed pattern suggests heterogeneous neighborhood conditions and possibly varying levels of investment or demand within the cluster.

Cluster 5 demonstrates a notable concentration of high-growth tracts extending along a north–south corridor. This pattern may reflect transit access, job proximity, or redevelopment activities that increased housing demand in these communities.

Cluster 6 shows the smallest number of tracts and appears more dispersed geographically. Most tracts show moderate growth, with only a few outliers showing very high appreciation. This suggests relatively stable neighborhoods with less intense market pressure compared to Clusters 2, 3, and 5.

Overall, the clusters with the strongest growth—particularly Clusters 2, 3, and 5—tend to be located in central and highly accessible areas, highlighting geographic inequality in the housing market. These patterns point to potential affordability challenges and displacement risks in high-growth clusters, while lower-growth clusters may reflect more stable or less competitive housing conditions. Understanding these differences can help policymakers focus housing interventions, monitor vulnerable areas, and design targeted affordability strategies.


Summary Table: Home Value Growth by Cluster

growth_summary <- sd %>% 
  st_drop_geometry() %>% 
  group_by(cluster) %>% 
  summarise(
    mean_growth = mean(mhv.growth, na.rm = TRUE),
    median_growth = median(mhv.growth, na.rm = TRUE),
    n = n()
  )

kable(growth_summary, digits = 2, caption = "Home Value Growth by Cluster")
Home Value Growth by Cluster
cluster mean_growth median_growth n
1 33.25 30.79 38
2 60.87 58.67 62
3 47.17 46.57 123
4 45.55 46.86 141
5 51.12 49.21 117
6 46.15 46.89 53

Interpretation:
The summary table highlights meaningful differences in median home-value growth across the six clusters. These clusters represent groups of census tracts with similar demographic or socioeconomic characteristics, and the growth patterns suggest that housing market pressures are unevenly distributed across the region.

Cluster 1 has the lowest average and median home-value growth (mean ≈ 33%; median ≈ 31%). This indicates relatively stable or slow-growing neighborhoods with limited recent investment or market pressure. These areas may experience less competition in the housing market.

Cluster 2 shows the highest growth by a wide margin, with mean growth near 61% and median growth near 59%. This cluster appears to contain neighborhoods experiencing rapid appreciation—likely driven by strong demand, redevelopment, desirable locations, or improving amenities. These areas may be more susceptible to affordability challenges or displacement.

Cluster 3 also shows elevated growth (mean ≈ 47%, median ≈ 47%), suggesting it includes neighborhoods with significant market activity and rising home values, though not as intense as Cluster 2.

Cluster 4 demonstrates moderate growth (mean ≈ 45%, median ≈ 47%), indicating a mix of neighborhood conditions—some tracts may be appreciating quickly, while others remain more stable.

Cluster 5 also shows relatively strong growth (mean ≈ 51%, median ≈ 49%). This suggests that neighborhoods in this cluster have experienced noticeable upward movement in housing values, which may reflect transit access, proximity to job centers, or other location advantages.

Cluster 6 shows moderate growth (mean ≈ 46%, median ≈ 47%), similar to Clusters 3–5, indicating steady but not extreme appreciation.

Overall, the clusters with the highest appreciation—especially Cluster 2, and to a lesser extent Clusters 3 and 5—appear to be areas where the housing market is most dynamic and where affordability pressures may be greatest. In contrast, Cluster 1’s comparatively low growth may reflect more stable or less desirable market conditions. These differences underline how neighborhood characteristics influence housing market behavior and highlight the importance of tailored policy responses to address affordability, equity, and community stability.


Narrative Summary

Overview
This analysis uses a Dorling cartogram of San Diego census tracts to examine demographic and housing trends. The selected focus variable—percent growth in median home value from 2000 to 2012 (mhv.growth)—provides insight into neighborhood economic change.

Spatial Patterns
The choropleth map shows wide variation across the county. Some tracts experienced dramatic increases in home values, while others saw more modest growth. High-growth tracts tend to cluster in specific geographic areas, suggesting regional housing pressures or local amenities driving demand.

Cluster Comparison
The faceted cluster map and summary table reveal appreciable differences in home-value growth across clusters. This indicates that neighborhood characteristics (e.g., demographics, built environment, socioeconomic status) may be associated with varying levels of housing appreciation.

Policy Implications
Understanding these trends can help policymakers: - identify areas at risk of gentrification
- target housing affordability programs
- prioritize community investment
- monitor inequality in economic opportunity


Conclusion

This code-through demonstrates how spatial data tools in R—especially sf, tmap, and the tidyverse—can be used to load, visualize, filter, and summarize geographic data. By mapping percent changes in median home values and comparing clusters of similar neighborhoods, the analysis highlights important differences in how housing markets evolve across San Diego County. These spatial patterns underscore the value of geographic analysis in public policy, particularly for identifying areas facing rising housing pressures, monitoring neighborhood change, and supporting data-informed decisions about housing affordability and community investment.