-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transport_VermontPDF.Rmd
3911 lines (3521 loc) · 225 KB
/
Transport_VermontPDF.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Transportation Options in Vermont"
author: "Marcos Luna and Neenah Estrella-Luna"
date: "`r Sys.Date()`"
output:
bookdown::pdf_document2:
toc: true
toc_depth: 3
number_sections: true
fig_caption: yes
includes:
in_header: my_header.tex
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo=FALSE, message=FALSE, warning=FALSE)
library(tidyverse)
library(sf)
library(tmap)
library(tidytransit)
library(sp)
library(tigris)
options(tigris_use_cache = TRUE, tigris_class = "sf")
library(lubridate)
library(maptools)
library(spdep)
library(lwgeom)
```
\pagebreak
# Analysis of adequacy of public transit, walkability, and transportation cost burden in Vermont
This is an analysis of access to public transit and walkability in Vermont.
```{r data, include=FALSE}
### Analysis of Vermont transportation options
load("DATA/ne_layers.rds")
# extract census units for state
vt_blkgrps_sf <- ne_blkgrp_sf %>%
filter(STATE == "Vermont") %>%
select(GEOID, NAME,STATE, bg_area_m2, totalpopE, minorityE, under5E, under18E, over64E, householdsE, eng_hhE, eng_limitE, age25upE, lthsE, povknownE, num2povE) %>%
st_transform(., crs = 2852) %>%
filter(!st_is_empty(.)) %>%
mutate(PopAcre = totalpopE/(bg_area_m2*0.000247105))
vt_tracts_sf <- ne_tracts_sf %>%
filter(STATE == "Vermont") %>%
select(GEOID, NAME, totalpopE, STATE, Over18E, disabledOver18E, totalHHE, HHnoCarE) %>%
st_transform(., crs = 2852) %>%
filter(!st_is_empty(.))
# clean up
rm(ne_blkgrp_sf,ne_tracts_sf,ne_blkgrp_sf90)
## Read in VT transit data from ... GTFS since state-provided GIS files are simply drawn from GTFS but are missing variables. GTFS from https://vermont-gtfs.org/
# # Download GTFS data for Advance Transit
# download.file(url = "http://data.trilliumtransit.com/gtfs/advancetransit-vt-us/advancetransit-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/AdvanceTransit.zip")
# # Download GTFS data for Green Mountain Transit
# download.file(url = "http://data.trilliumtransit.com/gtfs/ccta-vt-us/ccta-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/GreenMtnTransit.zip")
# # Download GTFS data for Current Transit
# download.file(url = "http://data.trilliumtransit.com/gtfs/crtransit-vt-us/crtransit-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/CurrentTransit.zip")
# # Download GTFS data for DVTA Moover
# download.file(url = "http://data.trilliumtransit.com/gtfs/dvtamoover-vt-us/dvtamoover-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/DVTAMooverTransit.zip")
# # Download GTFS data for Green Mountain Community Network
# download.file(url = "http://data.trilliumtransit.com/gtfs/greenmtncn-vt-us/greenmtncn-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/GreenMtnComNetworkTransit.zip")
# # Download GTFS data for Lake Champlain Ferries
# download.file(url = "http://data.trilliumtransit.com/gtfs/lctferries-vt-us/lctferries-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/LakeChamplainFerries.zip")
# # Download GTFS data for Rural Community Transportation
# download.file(url = "http://data.trilliumtransit.com/gtfs/ruralcommunity-vt-us/ruralcommunity-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/RuralComTransport.zip")
# # Download GTFS data for The Bus - Marble Valley Regional Transit District: Marble Valley
# download.file(url = "http://data.trilliumtransit.com/gtfs/thebus-vt-us/thebus-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/MarbleValleyTransit.zip")
# # Download GTFS data for Stagecoach Transportation Services, Tri-Valley Transit
# download.file(url = "http://data.trilliumtransit.com/gtfs/trivalleytransit-vt-us/trivalleytransit-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/TriValleyTransit.zip")
# # Download GTFS data for Vermont Translines
# download.file(url = "http://data.trilliumtransit.com/gtfs/vttranslines-vt-us/vttranslines-vt-us.zip", destfile = "DATA/transport/VT/VT_gtfs_files/VermontTranslines.zip")
# create list of downloaded GTFS files
fileList <- as.list(list.files("DATA/transport/VT/VT_gtfs_files/", pattern = ".zip$", full.names = TRUE))
# extract just file names without extension
fileListNames <- lapply(fileList,
function(x) fs::path_ext_remove(fs::path_file(x)))
# name items in fileList
fileList <- setNames(fileList,fileListNames)
# read in each file to gtfs
VT_gtfs_list <- lapply(fileList,
function(x) read_gtfs(x) %>%
gtfs_as_sf(.))
# add a table to the feed that indicates which service_id runs on which date. This is later useful for linking dates and trips via service_id.
VT_gtfs_list <- lapply(VT_gtfs_list, set_date_service_table)
# To understand service patterns better we need information on weekdays and holidays. With a calendar table we know the weekday and possible holidays for each date.
# create a function to generate calendar and join to date_servicepattern_table
calendarFunction <- function(thing) {
tibble(date = unique(thing$.$date_service_table$date)) %>%
mutate(
weekday = (function(date) {
c("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday",
"Saturday")[as.POSIXlt(date)$wday + 1]
})(date)
) %>%
left_join(x = thing$.$date_servicepattern_table,y = ., by = "date", copy=TRUE)
}
# To analyse on which dates trips run and to group similar services we use service patterns. Such a pattern simply lists all dates a trip runs on. To handle these patterns we create a servicepattern_id using a hash function.
VT_gtfs_list <- lapply(VT_gtfs_list, set_servicepattern)
# Our gtfs feed now contains the data frame service_pattern which links each servicepattern_id to an existing service_id (and by extension trip_id).
# Understand patterns of service by visualising the data.
# Iterate over list to generate service pattern tables
date_servicepattern_table_list <- lapply(X = VT_gtfs_list, calendarFunction)
# This part has to be done manually for each item. sigh.
# create function to generate service pattern graph for each item
ggplotPatterns <- function (x) {
ggplot(x) + theme_bw() +
geom_point(aes(x = date, y = servicepattern_id, color = weekday), size = 1) +
scale_x_date(breaks = scales::date_breaks("1 month")) +
theme(legend.position = "bottom")
}
# iterate through list and create plot for each. look at each and identify M-F servcie pattern ids.
ggplotServicePatterns <- lapply(date_servicepattern_table_list, ggplotPatterns)
AdvanceTransit_spids <- c("s_bd3d812","s_4834b03","s_3fbb598")
CurrentTransit_spids <- c("s_b8c28a8","s_6ec375d","s_4055657")
DVTAMooverTransit_spids <- c("s_aa691be","s_273dfe9","s_232a0a5","s_2141cf9")
GreenMtnComNetworkTransit_spids <- c("s_e633768", "s_b86cbed", "s_b134a45", "s_39b322f")
GreenMtnTransit_spids <- c("s_b258906","s_8cd8e19","s_199639b","s_121b32f")
LakeChamplainFerries_spids <- c("s_c03da1d","s_6cb5291")
MarbleValleyTransit_spids <- c("s_dec72ff","s_cc4d0f9","s_c5c8bb8","s_c045849", "s_06f20d5", "s_0418370")
RuralComTransport_spids <- c("s_f30b07e","s_a5157f4","s_60b8468")
TriValleyTransit_spids <- c("s_e5732f7","s_a2fbba2","s_1c55bc1")
VermontTranslines_spids <- "s_46f7ebd"
# create the list. make sure to remove spids_list before running, otherwise it gets included in the list!
spids_list <- mget(ls(pattern = "_spids"))
# iterate over list items to extract service ids
service_ids_list <- map2(VT_gtfs_list,spids_list,
function(x,y) x$.$service_pattern %>%
filter(servicepattern_id %in% y) %>%
pull(service_id))
# now that we’ve identified the set of service_id’s that refer to all weekday trips, we can summarize service between 6 am and 9 pm for bus service on weekdays.
# iterate over list items. skip Shore Line East because it's missing `direction-id` column
daily_stop_freq_list <- map2(VT_gtfs_list,service_ids_list,
function(x,y) get_stop_frequency(x, start_hour = 6, end_hour = 21, service_ids = y))
# # Convert stops to points for mapping
# Convert stops to points for mapping for each item in list
vt_transit_stops_sf_list <- lapply(X = VT_gtfs_list, function(x) stops_as_sf(x$stops))
# Join headway frequencies to stops and route descriptions
# first, join headway frequencies
vt_transit_stops_sf_list <- map2(vt_transit_stops_sf_list,daily_stop_freq_list,
function(x,y) x %>%
inner_join(y, by = "stop_id"))
# next, join route descriptions
vt_transit_stops_sf_list <- map2(vt_transit_stops_sf_list,VT_gtfs_list,
function(x,y) x %>%
inner_join(y$routes, by = "route_id"))
# use the get_route_frequency function to summarize transit service by route, for the same time period.
# iterate over list items
daily_route_freq_list <- map2(VT_gtfs_list,service_ids_list,
function(x,y)
get_route_frequency(x, service_ids = y))
# Join the route frequencies to geometry for mapping
# iterate over list to extract route geometry. need to skip Hartford Line and Shoreline East because they're missing shapes.
vt_routes_sf_list <- map2(VT_gtfs_list,service_ids_list,
function(x,y) get_route_geometry(x, service_ids = y))
# join calculated frequencies to geometry and route descriptions
# first, join calculated frequencies to geometry. Again, skip Hartford Line and Shoreline East.
vt_routes_sf_list <- map2(vt_routes_sf_list, daily_route_freq_list,
function(x,y) inner_join(x,y, by = "route_id"))
# next, join route descriptions to allow filtering
vt_routes_sf_list <- map2(vt_routes_sf_list,VT_gtfs_list,
function(x,y)
inner_join(x,y$routes, by = "route_id"))
# Extract bus routes and common set of variables and combine into one layer
vt_routes_sf_Bus <- lapply(vt_routes_sf_list, function(x)
filter(x, route_type == 3) %>%
select(route_id:mean_headways,agency_id,route_short_name,route_long_name)) %>%
do.call(rbind, .) %>%
mutate(agency = case_when(
agency_id == "738" ~ "Advance Transit",
agency_id == "232" ~ "The Current",
agency_id == "218" ~ "MOOver - DVTA",
agency_id == "219" ~ "Green Mountain Community Network",
agency_id == "461" ~ "Green Mountain Transit",
agency_id == "885" ~ "Special Services Transportation",
agency_id == "789" ~ "Lake Champlain Ferries",
agency_id == "220" ~ "Marble Valley Regional Transit",
agency_id == "221" ~ "Rural Community Transportation",
agency_id == "986" ~ "Tri Valley Transit",
agency_id == "228" ~ "Vermont Translines"
)) %>%
st_transform(., crs = 2852) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# create a simplified version for faster mapping
# vt_routes_sf_Bus_simple <- vt_routes_sf_Bus %>%
# st_simplify(., dTolerance = 100) %>%
# st_make_valid()
vt_routes_sf_Bus_simple <- vt_routes_sf_Bus %>%
# unique(.) %>%
group_by(route_short_name) %>%
summarize(agency = first(agency),agency_id = first(agency_id),mean_headways = mean(mean_headways,na.rm = TRUE)) %>%
st_make_valid()
# extract bus stops and merge to one layer
vt_stops_sf_Bus <- lapply(vt_transit_stops_sf_list, function(x)
filter(x, route_type == 3) %>%
select(agency_id,stop_id,route_type,headway)) %>%
do.call(rbind, .) %>%
mutate(agency = case_when(
agency_id == "738" ~ "Advance Transit",
agency_id == "232" ~ "The Current",
agency_id == "218" ~ "MOOver - DVTA",
agency_id == "219" ~ "Green Mountain Community Network",
agency_id == "461" ~ "Green Mountain Transit",
agency_id == "885" ~ "Special Services Transportation",
agency_id == "789" ~ "Lake Champlain Ferries",
agency_id == "220" ~ "Marble Valley Regional Transit",
agency_id == "221" ~ "Rural Community Transportation",
agency_id == "986" ~ "Tri Valley Transit",
agency_id == "228" ~ "Vermont Translines"
)) %>%
st_transform(., crs = 2852) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# clean up
rm(list = ls(pattern = "_list|List|spids"))
# read in park-and-ride lots from Vermont Open Geodata Portal at https://geodata.vermont.gov/ . Keep only park-and-rides that are serviced by public transit.
vt_parknride_sf <- st_read(dsn = "DATA/transport/VT/VT_Park_and_Rides",
layer = "VT_Park_and_Rides") %>%
filter(TRANSIT != "NONE") %>%
st_transform(., crs = 2852) %>%
st_make_valid()
# Use dasymetric mapping to calculate populations with access to transit. Approach follows method used by Qiang (2019) to eliminate unpopulated areas of census polygons and then reallocate populations to developed areas as identified in National Land Cover Dataset (NLCD).
# Perform NLCD raster-to-vector conversion, vector erase/difference, and vector intersections in ArcMap because it takes too long in R.
# In ArcMap:
# Convert NLCD raster to shapefile. Clip to state.
# Isolate undeveloped areas (gridcode NOT 22 - 24).
# Erase areas of block groups and tracts that overlap with undeveloped areas in NLCD shapefiles. Compute OldArea of erased polygons in sqm to identify area of developed polygons remaining.
##### Return to working in R ######
# # read in processed vt_blkgrps and vt_tracts
# st_layers(dsn = "DATA/FEMA/VT")
vt_blkgrps_developed <- st_read(dsn = "DATA/FEMA/VT",
layer = "vt_blkgrps_developed")
vt_blkgrps_developed <- vt_blkgrps_sf %>%
as.data.frame() %>%
dplyr::select(-geometry) %>%
left_join(vt_blkgrps_developed, ., by = "GEOID") %>%
st_transform(., crs = 2852) %>%
mutate(NewArea = st_area(.)) %>%
st_make_valid() %>%
mutate(Proportion = as.numeric(NewArea/OldArea),
NewPop = totalpopE*Proportion,
NewMinority = minorityE*Proportion,
NewUnder5 = under5E*Proportion,
NewOver64 = over64E*Proportion,
NewUnder18 = under18E*Proportion,
NewEng_limit = eng_limitE*Proportion,
NewPov = num2povE*Proportion,
NewLths = lthsE*Proportion,
NewPopAcre = NewPop/(NewArea*0.000247105))
vt_tracts_developed <- st_read(dsn = "DATA/FEMA/VT",
layer = "vt_tracts_developed") %>%
left_join(., as.data.frame(vt_tracts_sf), by = "GEOID") %>%
st_transform(., crs = 2852) %>%
mutate(NewArea = st_area(.)) %>%
st_make_valid() %>%
mutate(Proportion = as.numeric(NewArea/OldArea),
NewDisabled = disabledOver18E*Proportion,
NewOver18 = Over18E*Proportion,
NewHHNoCar = HHnoCarE*Proportion)
# create a simplified version for faster mapping
vt_blkgrps_developed_simple <- st_simplify(vt_blkgrps_developed,
dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# repeat for tracts
vt_tracts_developed_simple <- st_simplify(vt_tracts_developed,
dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# Create a 400m buffer around bus stops
vt_busBuff400m <- st_buffer(vt_stops_sf_Bus,dist = 400) %>%
st_union() %>%
st_as_sf()
# Create buffers around park-and-ride stops (4800m)
vt_prBuff4800m <- st_buffer(vt_parknride_sf, dist = 4800) %>%
st_union() %>%
st_as_sf()
vt_transitAllBuff <- rbind(vt_busBuff400m,
vt_prBuff4800m) %>%
st_union() %>%
st_as_sf() %>%
mutate(Sqm = st_area(.))
# Use areal interpolation to calculate priority populations within buffer of accessibility
vt_busBuff400m_sf <- vt_blkgrps_developed %>%
select(GEOID,NewArea:NewLths) %>%
mutate(OldArea = NewArea) %>%
st_intersection(vt_busBuff400m,.) %>%
mutate(NewArea = st_area(.),
Proportion = NewArea/OldArea,
NewPop = as.integer(NewPop*Proportion),
NewMinority = as.integer(NewMinority*Proportion),
NewUnder5 = as.integer(NewUnder5*Proportion),
NewOver64 = as.integer(NewOver64*Proportion),
NewUnder18 = as.integer(NewUnder18*Proportion),
NewEng_limit = as.integer(NewEng_limit*Proportion),
NewPov = as.integer(NewPov*Proportion),
NewLths = as.integer(NewLths*Proportion))
vt_prBuff4800m_sf <- vt_blkgrps_developed %>%
select(GEOID,NewArea:NewLths) %>%
mutate(OldArea = NewArea) %>%
st_intersection(vt_prBuff4800m,.) %>%
mutate(NewArea = st_area(.),
Proportion = NewArea/OldArea,
NewPop = as.integer(NewPop*Proportion),
NewMinority = as.integer(NewMinority*Proportion),
NewUnder5 = as.integer(NewUnder5*Proportion),
NewOver64 = as.integer(NewOver64*Proportion),
NewUnder18 = as.integer(NewUnder18*Proportion),
NewEng_limit = as.integer(NewEng_limit*Proportion),
NewPov = as.integer(NewPov*Proportion),
NewLths = as.integer(NewLths*Proportion))
vt_TransitAllBuff_sf <- vt_blkgrps_developed %>%
select(GEOID,NewArea:NewLths) %>%
mutate(OldArea = NewArea) %>%
st_intersection(vt_transitAllBuff,.) %>%
mutate(NewArea = st_area(.),
Proportion = NewArea/OldArea,
NewPop = as.integer(NewPop*Proportion),
NewMinority = as.integer(NewMinority*Proportion),
NewUnder5 = as.integer(NewUnder5*Proportion),
NewOver64 = as.integer(NewOver64*Proportion),
NewUnder18 = as.integer(NewUnder18*Proportion),
NewEng_limit = as.integer(NewEng_limit*Proportion),
NewPov = as.integer(NewPov*Proportion),
NewLths = as.integer(NewLths*Proportion))
# Repeat for tracts
vt_busBuff400mTracts_sf <- vt_tracts_developed %>%
select(GEOID,NewDisabled:NewHHNoCar) %>%
mutate(OldArea = st_area(.)) %>%
st_intersection(vt_busBuff400m,.) %>%
mutate(NewArea = st_area(.),
Proportion = NewArea/OldArea,
NewDisabled = as.integer(NewDisabled*Proportion),
NewNoCar = as.integer(NewHHNoCar*Proportion))
vt_prBuff4800mTracts_sf <- vt_tracts_developed %>%
select(GEOID,NewDisabled:NewHHNoCar) %>%
mutate(OldArea = st_area(.)) %>%
st_intersection(vt_prBuff4800m,.) %>%
mutate(NewArea = st_area(.),
Proportion = NewArea/OldArea,
NewDisabled = as.integer(NewDisabled*Proportion),
NewNoCar = as.integer(NewHHNoCar*Proportion))
vt_TransitAllBuffTracts_sf <- vt_tracts_developed %>%
select(GEOID,NewDisabled:NewHHNoCar) %>%
mutate(OldArea = st_area(.)) %>%
st_intersection(vt_transitAllBuff,.) %>%
mutate(NewArea = st_area(.),
Proportion = NewArea/OldArea,
NewDisabled = as.integer(NewDisabled*Proportion),
NewNoCar = as.integer(NewHHNoCar*Proportion))
# Compute total block group populations within transit stop buffers
vt_busBuff400m_df <- vt_busBuff400m_sf %>%
as.data.frame() %>%
summarize(`Total Pop` = sum(NewPop),
Minority = sum(NewMinority),
`Under 5` = sum(NewUnder5),
`Over 64` = sum(NewOver64),
`Under 18` = sum(NewUnder18),
`Limited English HH` = sum(NewEng_limit),
`Low Income` = sum(NewPov),
`No HS Dip` = sum(NewLths)) %>%
gather(key = Group, value = BusPop)
vt_prBuff4800m_df <- vt_prBuff4800m_sf %>%
as.data.frame() %>%
summarize(`Total Pop` = sum(NewPop),
Minority = sum(NewMinority),
`Under 5` = sum(NewUnder5),
`Over 64` = sum(NewOver64),
`Under 18` = sum(NewUnder18),
`Limited English HH` = sum(NewEng_limit),
`Low Income` = sum(NewPov),
`No HS Dip` = sum(NewLths)) %>%
gather(key = Group, value = ParknRidePop)
vt_TransitAllBuff_df <- vt_TransitAllBuff_sf %>%
as.data.frame() %>%
summarize(`Total Pop` = sum(NewPop),
Minority = sum(NewMinority),
`Under 5` = sum(NewUnder5),
`Over 64` = sum(NewOver64),
`Under 18` = sum(NewUnder18),
`Limited English HH` = sum(NewEng_limit),
`Low Income` = sum(NewPov),
`No HS Dip` = sum(NewLths)) %>%
gather(key = Group, value = TransitPop)
# Compute total tract populations within bus stop buffer
vt_busBuff400mTracts_df <- vt_busBuff400mTracts_sf %>%
as.data.frame() %>%
summarize(`Disabled` = sum(NewDisabled),
`No Car HH` = sum(NewNoCar)) %>%
gather(key = Group, value = BusPop)
vt_prBuff4800mTracts_df <- vt_prBuff4800mTracts_sf %>%
as.data.frame() %>%
summarize(`Disabled` = sum(NewDisabled),
`No Car HH` = sum(NewNoCar)) %>%
gather(key = Group, value = ParknRidePop)
vt_TransitAllBuffTracts_df <- vt_TransitAllBuffTracts_sf %>%
as.data.frame() %>%
summarize(`Disabled` = sum(NewDisabled),
`No Car HH` = sum(NewNoCar)) %>%
gather(key = Group, value = TransitPop)
# Compute total tract populations within the state for same groups
vt_tract_pops_df <- vt_tracts_sf %>%
as.data.frame() %>%
summarize(`Disabled` = sum(disabledOver18E),
`No Car HH` = sum(HHnoCarE)) %>%
gather(key = Group, value = VTPop) %>%
left_join(.,vt_busBuff400mTracts_df, by = "Group") %>%
left_join(.,vt_prBuff4800mTracts_df, by = "Group") %>%
left_join(.,vt_TransitAllBuffTracts_df, by = "Group")
# Compute populations for state, join with buffer pops
vt_transitAccessPops_df <- vt_blkgrps_sf %>%
as.data.frame() %>%
summarize(`Total Pop` = sum(totalpopE),
Minority = sum(minorityE),
`Under 5` = sum(under5E),
`Over 64` = sum(over64E),
`Under 18` = sum(under18E),
`Limited English HH` = sum(eng_limitE),
`Low Income` = sum(num2povE),
`No HS Dip` = sum(lthsE)) %>%
gather(key = Group, value = VTPop) %>%
left_join(., vt_busBuff400m_df, by = "Group") %>%
left_join(., vt_prBuff4800m_df, by = "Group") %>%
left_join(., vt_TransitAllBuff_df, by = "Group") %>%
rbind(.,vt_tract_pops_df) %>%
mutate(PctBus = BusPop/VTPop*100,
PctParknRide = ParknRidePop/VTPop*100,
PctAllTransit = TransitPop/VTPop*100)
# create point layer of towns for context
vt_towns_sf_pts <- county_subdivisions(state = "VT", cb = TRUE) %>%
filter(NAME %in% c("Brattleboro",
"Manchester",
"Rutland",
"Middlebury",
"Montpelier",
"Burlington",
"Stowe",
"Greensboro",
"Addison",
"Swanton",
"Berlin",
"Bennington",
"St. Albans"),
!GEOID %in% c("5002161225","5001161675")) %>% # remove duplicate Rutland and St. Albans points
st_transform(., crs = 2852) %>%
st_centroid(of_largest_polygon = TRUE)
# Create road layer for context
vt_highways <- primary_roads() %>%
filter(FULLNAME %in% c("I- 89","I- 91","I- 93")) %>%
tmaptools::crop_shape(., ne_states_sf_cb) %>%
st_transform(., crs = 2852)
vt_highways2nd <- primary_secondary_roads("VT") %>%
filter(FULLNAME %in% c("US Hwy 2","US Hwy 4","US Hwy 5","US Hwy 7")) %>%
st_transform(., crs = 2852)
# Extract highway segments for labeling
I89roadSegment <- vt_highways %>%
filter(LINEARID == "110492460319")
I91roadSegment <- vt_highways %>%
filter(LINEARID == "110344465713")
I91roadSegment2 <- vt_highways %>%
filter(LINEARID == "1103059124170")
I93roadSegment <- vt_highways %>%
filter(LINEARID == "1105281295268")
USHwy2Segment <- vt_highways %>%
filter(LINEARID == "1105317260813")
USHwy4Segment <- vt_highways %>%
filter(LINEARID == "1104258038927")
USHwy7Segment <- vt_highways %>%
filter(LINEARID == "1106087319624")
# Create custom icons of highway shields
I89 <- tmap_icons(file = "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/I-89.svg/200px-I-89.svg.png")
I91 <- tmap_icons("https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/I-91.svg/200px-I-91.svg.png")
I93 <- tmap_icons("https://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/I-93.svg/200px-I-93.svg.png")
Hwy2 <- tmap_icons("https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/US_2.svg/200px-US_2.svg.png")
Hwy4 <- tmap_icons("https://upload.wikimedia.org/wikipedia/commons/thumb/7/71/US_4.svg/200px-US_4.svg.png")
Hwy7 <- tmap_icons("https://upload.wikimedia.org/wikipedia/commons/thumb/9/95/US_7.svg/200px-US_7.svg.png")
# Bring in outline of New York for western boundary
ny_state_sf <- tigris::states(cb = TRUE) %>%
filter(NAME == "New York")
# # recode routes to match VTPTA categories
# vt_busroutes_sf <- vt_busroutes_sf %>%
# mutate(type = case_when(
# ROUTE %in% c(3,4,6,13,17,18,19,21,22,29,30,32,33,34,35,40,49,51,55,57,58,63,64,67,72,73,75,76,78,80,87) ~ "Urban Service",
# ROUTE == 11 ~ "Rapid Line",
# ROUTE %in% c(8,9,10,12,14,54,59,60,61,62,65,66,95) ~ "Express Service",
# ROUTE %in% c(1,20,27,28,31,50,56,71,92) ~ "Key Corridor",
# ROUTE %in% c(16,203,204,210,231,242,281,282,301) ~ "Flex Service"))
# Calculate totals of priority populations for use in computing percentages in later tables
# Calculate tract populations by state
statepopsdf_tracts <- vt_tracts_sf %>%
as.data.frame() %>%
group_by(STATE) %>%
summarize(TotalDisabled = sum(disabledOver18E, na.rm = TRUE),
TotalOver18 = sum(Over18E, na.rm = TRUE),
TotalNoCar = sum(HHnoCarE, na.rm = TRUE))
statepopsdf <- vt_blkgrps_sf %>%
as.data.frame() %>%
group_by(STATE) %>%
summarize(TotalPop = sum(totalpopE, na.rm = TRUE),
TotalHH = sum(householdsE, na.rm = TRUE),
TotalLEH = sum(eng_limitE, na.rm = TRUE),
TotalMin = sum(minorityE, na.rm = TRUE),
TotalLowInc = sum(num2povE, na.rm = TRUE),
TotalNoHS = sum(lthsE, na.rm = TRUE),
TotalOver64 = sum(over64E, na.rm = TRUE),
TotalUnder5 = sum(under5E, na.rm = TRUE),
TotalUnder18 = sum(under18E, na.rm = TRUE)) %>%
left_join(., statepopsdf_tracts,by="STATE")
# vt_towns_sf <- ne_towns_sf %>%
# dplyr::select(GEOID,NAME) %>%
# st_transform(., crs = 2852)
vt_towns_sf <- county_subdivisions(state = "VT", cb = TRUE) %>%
st_transform(., crs = 2852)
townpopsdf_tracts <- vt_tracts_sf %>%
st_centroid(.) %>%
st_intersection(vt_towns_sf,.) %>%
as.data.frame() %>%
group_by(NAME) %>%
summarize(TotalDisabled = sum(disabledOver18E, na.rm = TRUE),
TotalOver18 = sum(Over18E, na.rm = TRUE),
TotalNoCar = sum(HHnoCarE, na.rm = TRUE))
townpopsdf <- vt_blkgrps_sf %>%
dplyr::select(-GEOID) %>%
st_centroid(.) %>%
st_intersection(vt_towns_sf,.) %>%
as.data.frame() %>%
group_by(NAME) %>%
summarize(GEOID = unique(GEOID),
TotalPop = sum(totalpopE, na.rm = TRUE),
TotalHH = sum(householdsE, na.rm = TRUE),
TotalLEH = sum(eng_limitE, na.rm = TRUE),
TotalMin = sum(minorityE, na.rm = TRUE),
TotalLowInc = sum(num2povE, na.rm = TRUE),
TotalNoHS = sum(lthsE, na.rm = TRUE),
TotalOver64 = sum(over64E, na.rm = TRUE),
TotalUnder5 = sum(under5E, na.rm = TRUE),
TotalUnder18 = sum(under18E, na.rm = TRUE)) %>%
left_join(.,townpopsdf_tracts,by="NAME")
vt_state_sf_cb <- ne_states_sf_cb %>%
filter(NAME == "Vermont") %>%
st_transform(., crs = st_crs(vt_blkgrps_sf))
# Identify areas >= 1 mile from bus stops
# Create a 1 mile buffer around bus stops
vt_busBuff1mile <- st_buffer(vt_stops_sf_Bus,dist = 1609.34) %>%
st_union() %>%
st_as_sf()
# identify block groups that do not intersect with 1 mile from bus stop
vt_blkgrps_sf_noBus <- vt_blkgrps_developed %>%
filter(st_disjoint(.,vt_busBuff1mile,sparse = FALSE))
# Identify tracts that do not intersect with buffer
vt_tracts_sf_noBus <- vt_tracts_developed %>%
filter(st_disjoint(.,vt_busBuff1mile,sparse = FALSE))
# create simplified versions for faster mapping
vt_blkgrps_sf_noBus_simple <- vt_blkgrps_sf_noBus %>%
st_simplify(., dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
vt_tracts_sf_noBus_simple <- vt_tracts_sf_noBus %>%
st_simplify(., dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# Identify areas >= 10 miles from park-and-ride stops
vt_prBuff10mile <- vt_parknride_sf %>%
st_buffer(., dist = (10*1609.34)) %>%
st_union() %>%
st_as_sf()
# identify block groups that do not intersect with 10 mile buffer
vt_blkgrps_sf_noPR <- vt_blkgrps_developed %>%
filter(st_disjoint(.,vt_prBuff10mile,sparse = FALSE))
# create simplified version of block groups for faster mapping
vt_blkgrps_sf_noPR_simple <- vt_blkgrps_sf_noPR %>%
select(NewPop:NewLths) %>%
st_simplify(., dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# identify tracts that do not intersect with 10 mile buffer
vt_tracts_sf_noPR <- vt_tracts_developed %>%
filter(st_disjoint(.,vt_prBuff10mile,sparse = FALSE))
# create simplified version of tracts for faster mapping
vt_tracts_sf_noPR_simple <- vt_tracts_sf_noPR %>%
select(NewDisabled:NewHHNoCar) %>%
st_simplify(., dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# Identify areas with no access to any type of transit stop. Union all buffers to create one buffer and clip to state boundary.
vt_transitBuffAll <- rbind(vt_busBuff1mile,
vt_prBuff10mile) %>%
st_union() %>%
st_as_sf() %>%
tmaptools::crop_shape(.,vt_state_sf_cb,polygon = TRUE)
# identify block groups that do not intersect with any transit buffer
vt_blkgrps_sf_noTransit <- vt_blkgrps_developed %>%
filter(st_disjoint(.,vt_transitBuffAll,sparse = FALSE))
# identify tracts that do not intersect with 5 mile buffer
vt_tracts_sf_noTransit <- vt_tracts_developed %>%
filter(st_disjoint(.,vt_transitBuffAll,sparse = FALSE))
# create simplified versions for faster mapping
vt_blkgrps_sf_noTransit_simple <- vt_blkgrps_sf_noTransit %>%
st_simplify(., dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
vt_tracts_sf_noTransit_simple <- vt_tracts_sf_noTransit %>%
st_simplify(., dTolerance = 100) %>%
filter(!st_is_empty(.)) %>%
st_make_valid()
# write out to file for later analysis
save(vt_blkgrps_sf_noTransit, vt_tracts_sf_noTransit,
vt_blkgrps_sf_noBus, vt_transitAccessPops_df, vt_busBuff400m_sf,
file = "DATA/transport/VT/noTransit.Rds")
```
## Access to Public Transit
This analysis seeks to identify communities that are underserved by access to public transit. Access to transit is measured in terms of distance to transit boarding stops and in terms of frequency of service.
Vermont is served by 10 local bus agencies or transit districts, two inter-state rail lines operated by Amtrak, local and inter-state ferry services on Lake Champlain, and several private inter-city bus services. In addition, there are over 100 park-and-ride lots throughout the state, variously owned by the state, municipalities, and by public transit agencies. The analysis presented here only considers public transit services for which publicly available geospatial data is available, which includes the `r length(unique(vt_routes_sf_Bus$agency))`
regional public transit agencies and the `r nrow(vt_parknride_sf)` park-and-ride lots that are directly serviced by these transit agencies. Amtrak train service, private inter-city buses, ferry services, water taxis, and seasonal transportation services are not considered in this analysis. Figure \@ref(fig:transitMap) shows `r formatC(nrow(vt_routes_sf_Bus),big.mark = ",")` fixed public transit routes across the state along with population density.
```{r transitMap, fig.align = "center", fig.cap="Transit service and population density in Vermont."}
# bbox_new <- st_bbox(ct_blkgrps_sf) # current bounding box
#
# xrange <- bbox_new$xmax - bbox_new$xmin # range of x values
# yrange <- bbox_new$ymax - bbox_new$ymin # range of y values
#
# # bbox_new[1] <- bbox_new[1] - (2.2 * xrange) # xmin - left
# # bbox_new[3] <- bbox_new[3] + (2 * xrange) # xmax - right
# bbox_new[2] <- bbox_new[2] - (0.2 * yrange) # ymin - bottom
# # bbox_new[4] <- bbox_new[4] + (2 * yrange) # ymax - top
#
# bbox_new <- bbox_new %>% # take the bounding box ...
# st_as_sfc() # ... and make it a sf polygon
m <- tm_shape(vt_towns_sf, unit = "mi") +
tm_borders(col = "gray", lwd = 0.2) +
tm_shape(vt_blkgrps_developed_simple) +
tm_fill(col = "NewPopAcre", style = "quantile",
colorNA = "white", colorNULL = "gray", title = "Pop per Acre",
legend.format = list(fun = function(x) formatC(x, digits = 1, format = "f")), palette = "YlGn") +
tm_shape(ne_states_sf_cb) + tm_borders(lwd = 0.2, alpha = 0.8) +
tm_text("STUSPS", size = 0.7, remove.overlap = TRUE, col = "gray") +
tm_shape(ny_state_sf) + tm_borders(lwd = 0.2, alpha = 0.8) +
tm_shape(vt_highways) + tm_lines(col = "seashell4", lwd = 1.5) +
tm_shape(vt_highways2nd) + tm_lines(col = "seashell4", lwd = 1.5) +
tm_shape(vt_routes_sf_Bus_simple) + tm_lines(col = "coral", lwd = 1) +
tm_shape(vt_parknride_sf) + tm_dots(col = "red", size = 0.1) +
tm_shape(I89roadSegment) +
tm_symbols(shape = I89, border.lwd = NA, size = 0.1) +
tm_shape(I91roadSegment) +
tm_symbols(shape = I91, border.lwd = NA, size = 0.1) +
tm_shape(I91roadSegment2) +
tm_symbols(shape = I91, border.lwd = NA, size = 0.1) +
tm_shape(I93roadSegment) +
tm_symbols(shape = I93, border.lwd = NA, size = 0.1) +
tm_shape(vt_towns_sf_pts) + tm_dots() +
tm_text("NAME", size = 0.5, col = "black",
xmod = 0.7, ymod = 0.2, shadow = TRUE) +
tm_scale_bar(breaks = c(0, 10, 20), text.size = 0.5,
position = c(0.6,0.005)) +
tm_add_legend(type = "line", labels = "Bus Routes", col = "coral") +
tm_add_legend(type = "symbol", labels = "Park-and-Ride Lots",
col = "red", size = 0.2, border.lwd = 0) +
tm_layout(title = "Vermont\nTransit Routes\nand Population\nDensity",
frame = FALSE, main.title.size = 0.8,
legend.outside = TRUE,
legend.title.size = 0.8,
legend.outside.position = c("right", "top"))
tmap_save(m, "DATA/transport/VT/figures/vt_transit.png",
height = 8, width = 8, units = "in", dpi = 600)
knitr::include_graphics("DATA/transport/VT/figures/vt_transit.png")
```
Approximately `r paste0(round(vt_transitAccessPops_df %>% filter(Group == "Total Pop") %>% dplyr::select(PctAllTransit) %>% pull(),1),"%")` of the state population lives within reasonable walking distance of a bus stop (defined as approximately 400 meters or 1/4 mile) or 3 miles of a park-and-ride lot that is serviced by transit.
However, this access varies by population group. Figure \@ref(fig:loliBusDist) below compare the percentages of different population groups living within reasonable walking distance of bus stops (1/4 mile) or within 3 miles of park-and-ride lots across the state. More than half of the priority populations, including transit-dependent groups, have access similar to or better than the general population. However, children under 5, people under 18 and over 64, and adults without a high school diploma have consistently less access to transit on average compared to the general population.
```{r loliBusDist, echo=FALSE, message=FALSE, warning=FALSE, fig.align = "center", fig.cap="Percentage of population groups within 1/4 mile (400 meters) of a bus stop or 3 miles (4800m) of park-and-ride lot across Vermont"}
vt_transitAccessPops_df %>%
mutate(Group = recode(Group, "Minority" = "People of Color",
"No HS Dip" = "No HS Diploma")) %>%
ggplot(aes(x = reorder(Group,-PctAllTransit),
y = PctAllTransit)) +
geom_segment(aes(x = reorder(Group,-PctAllTransit), xend = reorder(Group,-PctAllTransit),
y = vt_transitAccessPops_df[1,8], yend = PctAllTransit),
color = "skyblue") +
geom_point(color = "blue", size = 4, alpha = 0.8) +
coord_flip() + xlab("") + ylab("") + ggtitle("Vermont Populations within Walking Distance (400m)\nof Bus Stops or 4800m of Park-and-Ride Lots") + theme_light() +
theme(panel.grid.major.y = element_blank(),
panel.border = element_blank(),
axis.ticks.y = element_blank()) +
geom_text(aes(x = Group, y = PctAllTransit + 0.2 * sign(PctAllTransit),
label = paste0(round(PctAllTransit,1),"%")),
hjust = 0, vjust = -.4, size = 3,
color=rgb(100,100,100, maxColorValue=255)) +
scale_y_continuous(labels = function(x) paste0(x, "%")) +
geom_hline(yintercept = vt_transitAccessPops_df[1,8], linetype = "dashed") +
geom_text(aes(x = "Total Pop", y = 43, label = "Above state\naverage"),
color = "gray48") +
geom_text(aes(x = "Total Pop", y = 36, label = "Below state\naverage"),
color = "gray48") +
expand_limits(y = c(35,51))
ggsave("images/VT_Bus_graph.png")
```
Specific values of the same can be seen in Table \@ref(tab:statsTransitDist) below.
```{r statsTransitDist, echo=FALSE, message=FALSE, warning=FALSE, fig.align = "center", fig.cap="Vermont populations living within 1/4 mile (400 meters) of a bus stop or 3 miles (4800m) of a park-and-ride lot. Based on ACS 2018 Block Group data."}
# See table of distance by group
vt_transitAccessPops_df %>%
mutate(Group = recode(Group, "Minority" = "People of Color",
"No HS Dip" = "No HS Diploma")) %>%
mutate(PctBus = paste0(round(PctBus,1),"%"),
PctParknRide = paste0(round(PctParknRide,1),"%"),
PctAllTransit = paste0(round(PctAllTransit,1),"%")) %>%
kableExtra::kable(longtable = T, booktabs = T,
format.args = list(big.mark = ','), align = "r",
caption = "Populations with Access to Transit",
col.names = c("Group","VT Pop","Bus","ParknRide","Any Transit","Bus","ParknRide","Any Transit")) %>%
kableExtra::column_spec(3:8, width = "1.7cm") %>%
kableExtra::add_header_above(c(" " = 2, "Total Pop with Access" = 3, "Pct Pop with Access" = 3)) %>%
kableExtra::footnote(general = "Access is 1/4 mile (400m) from bus stop or 3 miles (4800m) from park-and-ride lots.") %>%
kableExtra::kable_styling(latex_options = c("repeat_header","striped"))
```
The population percentages above provide a glimpse of average access to public transit across the state for different population groups. However, access also varies for specific communities. Indeed, it is important to consider vulnerable populations or transportation-limited populations that do not have reasonable access to transit.
```{r TransitNoAccess, include=FALSE}
TransitNoAccess1 <- vt_blkgrps_sf_noTransit %>%
st_centroid(.) %>%
st_intersection(vt_towns_sf,.) %>%
as.data.frame() %>%
left_join(., townpopsdf,by="NAME") %>%
group_by(NAME) %>%
summarize(`Block Groups` = n(),
`Under 5` = sum(NewOver64,na.rm = TRUE),
`Pct of Under 5` = round(sum(NewUnder5)/max(TotalUnder5)*100,1)) %>%
rename("City/Town" = NAME) %>%
filter(`Pct of Under 5` > 0) %>%
mutate(`Pct of Under 5` = if_else(`Pct of Under 5` > 100, 100, `Pct of Under 5`)) %>%
mutate(`Pct of Under 5` = paste0(`Pct of Under 5`,"%")) %>%
arrange(desc(`Under 5`))
TransitNoAccess2 <- vt_blkgrps_sf_noTransit %>%
st_centroid(.) %>%
st_intersection(vt_towns_sf,.) %>%
as.data.frame() %>%
left_join(., townpopsdf,by="NAME") %>%
group_by(NAME) %>%
summarize(`Block Groups` = n(),
`Under 18` = sum(NewOver64,na.rm = TRUE),
`Pct of Under 18` = round(sum(NewUnder18)/max(TotalUnder18)*100,1)) %>%
rename("City/Town" = NAME) %>%
filter(`Pct of Under 18` > 0) %>%
mutate(`Pct of Under 18` = if_else(`Pct of Under 18` > 100, 100, `Pct of Under 18`)) %>%
mutate(`Pct of Under 18` = paste0(`Pct of Under 18`,"%")) %>%
arrange(desc(`Under 18`))
```
Figures \@ref(fig:mapTransitAccessU5) and \@ref(fig:mapTransitAccessU18) below highlight developed portions of Census Block Groups across Vermont without reasonable access to bus or park-and-ride lots, and the numbers of persons under 5 and under 18 who live there. Tables \@ref(tab:tabTransitAccessU5) and \@ref(tab:tabTransitAccessU18) show breakdowns of the same by municipality. For example, Table \@ref(tab:tabTransitAccessU5) shows that `r formatC(as.numeric(TransitNoAccess1[1,3]),big.mark=",")` children under 5 across `r TransitNoAccess1[1,2]` Block Groups in `r TransitNoAccess1[1,1]` resided one or more miles from the nearest bust stop. These people represented `r TransitNoAccess1[1,4]` of children under 5 in `r TransitNoAccess1[1,1]`. Similarly, Table \@ref(tab:tabTransitAccessU18) shows that `r formatC(as.numeric(TransitNoAccess2[1,3]),big.mark=",",digits = 5)` people under 18 across `r TransitNoAccess2[1,2]` Block Groups in `r TransitNoAccess2[1,1]` resided one or more miles from the nearest transit stop for any mode. These people represented `r TransitNoAccess2[1,4]` of people under 18 in `r TransitNoAccess2[1,1]`.
Maps and tables of other priority populations without access to the various modes of transit can be found in Appendix B.
```{r mapTransitAccessU5, fig.align = "center", fig.cap="Children under 5 without reasonable access to any form of transit by Census Block Group."}
m <- tm_shape(vt_state_sf_cb, unit = "mi") +
tm_fill(col = "gray",alpha = 0.2) +
tm_shape(vt_blkgrps_sf_noTransit_simple, unit = "mi") +
tm_fill(col = "NewUnder5", style = "quantile",
colorNA = "white", colorNULL = "gray", title = "Number of\nChildren Under 5",
legend.format = list(fun = function(x) formatC(x, digits = 0, format = "f")), palette = "OrRd") +
tm_shape(vt_tracts_sf) + tm_borders(alpha = 0.5, lwd = 0.2) +
tm_shape(ne_states_sf_cb) + tm_borders(lwd = 0.2, alpha = 0.8) +
tm_text("STUSPS", size = 0.7, remove.overlap = TRUE, col = "gray") +
tm_shape(ny_state_sf) + tm_borders(lwd = 0.2, alpha = 0.8) +
tm_shape(vt_highways) + tm_lines(col = "seashell4", lwd = 1.5) +
tm_shape(vt_highways2nd) + tm_lines(col = "seashell4", lwd = 1.5) +
tm_shape(I89roadSegment) +
tm_symbols(shape = I89, border.lwd = NA, size = 0.1) +
tm_shape(I91roadSegment) +
tm_symbols(shape = I91, border.lwd = NA, size = 0.1) +
tm_shape(I91roadSegment2) +
tm_symbols(shape = I91, border.lwd = NA, size = 0.1) +
tm_shape(I93roadSegment) +
tm_symbols(shape = I93, border.lwd = NA, size = 0.1) +
tm_shape(vt_towns_sf_pts) + tm_dots() +
tm_text("NAME", size = 0.5, col = "black",
xmod = 0.7, ymod = 0.2, shadow = TRUE) +
tm_scale_bar(breaks = c(0, 10, 20), text.size = 0.5,
position = c(0.6,0.005)) +
tm_layout(title = "Children Under 5\nwithout Reasonable\nAccess to any\nMode of Transit",
frame = FALSE, main.title.size = 0.8,
legend.outside = TRUE,
legend.title.size = 0.8,
legend.outside.position = c("right", "top"))
tmap_save(m, "DATA/transport/VT/figures/vt_transitU5access.png",
height = 8, width = 8, units = "in", dpi = 600)
knitr::include_graphics("DATA/transport/VT/figures/vt_transitU5access.png")
```
```{r tabTransitAccessU5, fig.align = "center", fig.cap="Children under 5 in Census Block Groups without reasonable access to any mode of transit."}
vt_blkgrps_sf_noTransit %>%
st_centroid(.) %>%
st_intersection(vt_towns_sf,.) %>%
as.data.frame() %>%
left_join(., townpopsdf,by="NAME") %>%
group_by(NAME) %>%
summarize(`Block Groups` = n(),
`Under 5` = sum(NewUnder5,na.rm = TRUE),
`Pct of Under 5` = round(sum(NewUnder5)/max(TotalUnder5)*100,1)) %>%
rename("City/Town" = NAME) %>%
filter(`Pct of Under 5` > 0) %>%
mutate(`Pct of Under 5` = if_else(`Pct of Under 5` > 100,100,`Pct of Under 5`)) %>%
mutate(`Pct of Under 5` = paste0(`Pct of Under 5`,"%")) %>%
arrange(desc(`Under 5`)) %>%
kableExtra::kable(longtable = T, booktabs = T,
format.args = list(big.mark = ','),
digits = 1,
caption = "Children Under 5 without Access to any Mode of Transit", align = "r", col.names = c(names(.)[1:2],"Number of Under 5 in Census Block Groups","Pct of Under 5 in City/Town")) %>%
kableExtra::column_spec(3:4, width = "4cm") %>%
kableExtra::kable_styling(latex_options = c("repeat_header","striped"))
```
```{r mapTransitAccessU18, fig.align = "center", fig.cap="Persons under 18 without reasonable access to any form of transit by Census Block Group."}
m <- tm_shape(vt_state_sf_cb, unit = "mi") +
tm_fill(col = "gray",alpha = 0.2) +
tm_shape(vt_blkgrps_sf_noTransit_simple, unit = "mi") +
tm_fill(col = "NewUnder18", style = "quantile",
colorNA = "white", colorNULL = "gray", title = "Number of\nPersons Under 18",
legend.format = list(fun = function(x) formatC(x, digits = 0, format = "f")), palette = "OrRd") +
tm_shape(vt_tracts_sf) + tm_borders(alpha = 0.5, lwd = 0.2) +
tm_shape(ne_states_sf_cb) + tm_borders(lwd = 0.2, alpha = 0.8) +
tm_text("STUSPS", size = 0.7, remove.overlap = TRUE, col = "gray") +
tm_shape(ny_state_sf) + tm_borders(lwd = 0.2, alpha = 0.8) +
tm_shape(vt_highways) + tm_lines(col = "seashell4", lwd = 1.5) +
tm_shape(vt_highways2nd) + tm_lines(col = "seashell4", lwd = 1.5) +
tm_shape(I89roadSegment) +
tm_symbols(shape = I89, border.lwd = NA, size = 0.1) +
tm_shape(I91roadSegment) +
tm_symbols(shape = I91, border.lwd = NA, size = 0.1) +
tm_shape(I91roadSegment2) +
tm_symbols(shape = I91, border.lwd = NA, size = 0.1) +
tm_shape(I93roadSegment) +
tm_symbols(shape = I93, border.lwd = NA, size = 0.1) +
tm_shape(vt_towns_sf_pts) + tm_dots() +
tm_text("NAME", size = 0.5, col = "black",
xmod = 0.7, ymod = 0.2, shadow = TRUE) +
tm_scale_bar(breaks = c(0, 10, 20), text.size = 0.5,
position = c(0.6,0.005)) +
tm_layout(title = "Persons Under 18\nwithout Reasonable\nAccess to any\nMode of Transit",
frame = FALSE, main.title.size = 0.8,
legend.outside = TRUE,
legend.title.size = 0.8,
legend.outside.position = c("right", "top"))
tmap_save(m, "DATA/transport/VT/figures/vt_transitU18access.png",
height = 8, width = 8, units = "in", dpi = 600)
knitr::include_graphics("DATA/transport/VT/figures/vt_transitU18access.png")
```
```{r tabTransitAccessU18, fig.align = "center", fig.cap="Persons under 18 in Census Block Groups without reasonable access to any mode of transit."}
vt_blkgrps_sf_noTransit %>%
st_centroid(.) %>%
st_intersection(vt_towns_sf,.) %>%
as.data.frame() %>%
left_join(., townpopsdf,by="NAME") %>%
group_by(NAME) %>%
summarize(`Block Groups` = n(),
`Under 18` = sum(NewUnder18,na.rm = TRUE),
`Pct of Under 18` = round(sum(NewUnder18)/max(TotalUnder18)*100,1)) %>%
rename("City/Town" = NAME) %>%
filter(`Pct of Under 18` > 0) %>%
mutate(`Pct of Under 18` = if_else(`Pct of Under 18` > 100,100,`Pct of Under 18`)) %>%
mutate(`Pct of Under 18` = paste0(`Pct of Under 18`,"%")) %>%
arrange(desc(`Under 18`)) %>%
kableExtra::kable(longtable = T, booktabs = T,
format.args = list(big.mark = ','),
digits = 1,
caption = "Persons Under 18 without Access to any Mode of Transit", align = "r", col.names = c(names(.)[1:2],"Number of Under 18 in Census Block Groups","Pct of Under 18 in City/Town")) %>%
kableExtra::column_spec(3:4, width = "4cm") %>%
kableExtra::kable_styling(latex_options = c("repeat_header","striped"))
```
## Frequency of Transit Service
The quality of access to public transit can also be assessed by the level or frequency of service, which is measured by "headway." Headway describes the scheduled or observed time between transit vehicle arrivals at a transit stop. For example, a bus route with a 15 minute headway would mean that the bus arrives at a given stop four times an hour (it's frequency), or once every 15 minutes. Transit headways are affected by the scheduled frequency of service, the number of vehicles on a given route, traffic delays, and dispatch management of vehicle spacing.[^mindGap] Headways are significant because they affect the desirability and useability of transit service.[^headways] Headways can affect:
* average wait times
* the amount of planning and preparation needed to use transit and stay on schedule
* the amount of time lost when transit schedules do not directly conform to work, school, or activity schedules
* the time penalty for missing a train or bus
* public use or support of transit
Headways are significant for transit dependent populations and can affect the quality of life and economic opportunities of transit riders. Figure \@ref(fig:mapGTFSbus) below shows average scheduled headways for bus routes throughout Vermont.[^headwayReal] Headways vary significantly by route and by type of service across the state.
```{r GTFS, include=FALSE}
# Calculate average headway for block groups within walking distance of bus stops and then compute weighted average headway by population group
vt_bus_stopHeadway_df <- vt_stops_sf_Bus %>%
st_transform(., crs = 2852) %>%
st_join(., vt_busBuff400m_sf) %>%
as.data.frame() %>%
group_by(GEOID) %>%
summarize(AvgStopHeadway = mean(headway,na.rm = TRUE))
# Create same for tracts
vt_bus_stopHeadwayTracts_df <- vt_stops_sf_Bus %>%
st_transform(., crs = 2852) %>%
st_join(., vt_busBuff400mTracts_sf) %>%
as.data.frame() %>%
group_by(GEOID) %>%
summarize(AvgStopHeadway = mean(headway,na.rm = TRUE))
# Create version of vt_bus_stopHeadwayTracts_df for rbind