diff --git a/NEWS.md b/NEWS.md index 0dfa0de0..705760ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ - `read_gtfs()` can now read `locations.geojson` files according to the updated specifications [#214](https://github.com/r-transit/tidytransit/pull/214) - tidytransit 1.7.0 needs `gtfsio` 1.2.0 as it uses json reading capabilities from `gtfsio::import_gtfs()` - Internally, the automatically parsed specifications from https://gtfs.org/documentation/schedule/reference/ are now used +- The example feed `google_transit_nyc_subway.zip` has been modified and renamed to `nyc_subway.zip` [#218](https://github.com/r-transit/tidytransit/pull/218) # tidytransit 1.6.1 diff --git a/R/filters.R b/R/filters.R index 6a1e57f2..28609a03 100644 --- a/R/filters.R +++ b/R/filters.R @@ -8,7 +8,7 @@ #' @export #' @examples \donttest{ #' library(dplyr) -#' local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' nyc <- read_gtfs(local_gtfs_path) #' select_service_id <- filter(nyc$calendar, monday==1) %>% pull(service_id) #' select_route_id <- sample_n(nyc$routes, 1) %>% pull(route_id) diff --git a/R/geo.R b/R/geo.R index 4d1d5f13..9b3bd77b 100644 --- a/R/geo.R +++ b/R/geo.R @@ -13,7 +13,7 @@ #' \dontrun{ #' library(dplyr) #' -#' nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' nyc <- read_gtfs(nyc_path) #' #' nyc$stops %>% @@ -103,7 +103,7 @@ prep_dist_mtrx = function(dist_list) { #' \dontrun{ #' library(dplyr) #' -#' nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' nyc <- read_gtfs(nyc_path) #' #' stop_group_distances(nyc$stops) @@ -185,7 +185,7 @@ stop_group_distances = function(gtfs_stops, by = "stop_name") { #' @importFrom stats kmeans #' @examples \donttest{ #' library(dplyr) -#' nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' nyc <- read_gtfs(nyc_path) #' nyc <- cluster_stops(nyc) #' diff --git a/R/io.R b/R/io.R index ea32c456..740f1d6b 100644 --- a/R/io.R +++ b/R/io.R @@ -17,7 +17,7 @@ #' @seealso [validate_gtfs()], [write_gtfs()] #' #' @examples \dontrun{ -#' local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' gtfs <- read_gtfs(local_gtfs_path) #' summary(gtfs) #' diff --git a/R/plot.R b/R/plot.R index 06041906..eaea9822 100644 --- a/R/plot.R +++ b/R/plot.R @@ -6,7 +6,7 @@ #' #' @examples \donttest{ #' local_gtfs_path <- system.file("extdata", -#' "google_transit_nyc_subway.zip", +#' "nyc_subway.zip", #' package = "tidytransit") #' nyc <- read_gtfs(local_gtfs_path) #' plot(nyc) diff --git a/R/raptor.R b/R/raptor.R index 2d74330e..f539c27d 100644 --- a/R/raptor.R +++ b/R/raptor.R @@ -50,7 +50,7 @@ #' @import data.table #' @export #' @examples \donttest{ -#' nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' nyc <- read_gtfs(nyc_path) #' #' # you can use initial walk times to different stops in walking distance (arbitrary example values) diff --git a/R/summary.R b/R/summary.R index f719c66f..27b000eb 100644 --- a/R/summary.R +++ b/R/summary.R @@ -10,7 +10,7 @@ #' #' @examples \dontrun{ #' path = system.file("extdata", -#' "google_transit_nyc_subway.zip", +#' "nyc_subway.zip", #' package = "tidytransit") #' #' g = read_gtfs(path) diff --git a/R/travel_times.R b/R/travel_times.R index 9b38ae78..9cee7574 100644 --- a/R/travel_times.R +++ b/R/travel_times.R @@ -69,7 +69,7 @@ #' #' # 2) separate filtering and travel time calculation for a more granular analysis #' # stop_names in this feed are not restricted to an area, create clusters of stops to fix -#' nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' nyc <- read_gtfs(nyc_path) #' nyc <- cluster_stops(nyc, group_col = "stop_name", cluster_colname = "stop_name") #' diff --git a/R/validate_gtfs.R b/R/validate_gtfs.R index 86b7a1b9..c3e05ef2 100644 --- a/R/validate_gtfs.R +++ b/R/validate_gtfs.R @@ -60,7 +60,7 @@ #' #> # 2 more variables: validation_status , validation_details #' #' \dontrun{ -#' local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +#' local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") #' gtfs <- read_gtfs(local_gtfs_path) #' attr(gtfs, "validation_result") #' diff --git a/inst/extdata/google_transit_nyc_subway.zip b/inst/extdata/google_transit_nyc_subway.zip deleted file mode 100644 index 47bf2218..00000000 Binary files a/inst/extdata/google_transit_nyc_subway.zip and /dev/null differ diff --git a/inst/extdata/nyc_subway.zip b/inst/extdata/nyc_subway.zip new file mode 100644 index 00000000..72eeecdc Binary files /dev/null and b/inst/extdata/nyc_subway.zip differ diff --git a/man/cluster_stops.Rd b/man/cluster_stops.Rd index fa424f8e..ee3479d8 100644 --- a/man/cluster_stops.Rd +++ b/man/cluster_stops.Rd @@ -39,7 +39,7 @@ which contains the \code{group_col} value and the cluster number. \examples{ \donttest{ library(dplyr) -nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(nyc_path) nyc <- cluster_stops(nyc) diff --git a/man/filter_stops.Rd b/man/filter_stops.Rd index ab1cebf9..fc405346 100644 --- a/man/filter_stops.Rd +++ b/man/filter_stops.Rd @@ -22,7 +22,7 @@ Get a set of stops for a given set of service ids and route ids \examples{ \donttest{ library(dplyr) -local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(local_gtfs_path) select_service_id <- filter(nyc$calendar, monday==1) \%>\% pull(service_id) select_route_id <- sample_n(nyc$routes, 1) \%>\% pull(route_id) diff --git a/man/plot.tidygtfs.Rd b/man/plot.tidygtfs.Rd index 532d3b48..0774a232 100644 --- a/man/plot.tidygtfs.Rd +++ b/man/plot.tidygtfs.Rd @@ -20,7 +20,7 @@ Plot GTFS stops and trips \examples{ \donttest{ local_gtfs_path <- system.file("extdata", - "google_transit_nyc_subway.zip", + "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(local_gtfs_path) plot(nyc) diff --git a/man/print.tidygtfs.Rd b/man/print.tidygtfs.Rd index 0672a1fc..8d1fba04 100644 --- a/man/print.tidygtfs.Rd +++ b/man/print.tidygtfs.Rd @@ -21,7 +21,7 @@ validation_result attribute, created with \code{\link[=validate_gtfs]{validate_g \examples{ \dontrun{ path = system.file("extdata", - "google_transit_nyc_subway.zip", + "nyc_subway.zip", package = "tidytransit") g = read_gtfs(path) diff --git a/man/raptor.Rd b/man/raptor.Rd index 03b1a547..6a1ae737 100644 --- a/man/raptor.Rd +++ b/man/raptor.Rd @@ -71,7 +71,7 @@ until it exceeds \code{max_transfers} or all trips in \code{stop_times} have bee } \examples{ \donttest{ -nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(nyc_path) # you can use initial walk times to different stops in walking distance (arbitrary example values) diff --git a/man/read_gtfs.Rd b/man/read_gtfs.Rd index cf82416f..afd47d20 100644 --- a/man/read_gtfs.Rd +++ b/man/read_gtfs.Rd @@ -28,7 +28,7 @@ GTFS specifications. } \examples{ \dontrun{ -local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") gtfs <- read_gtfs(local_gtfs_path) summary(gtfs) diff --git a/man/stop_distances.Rd b/man/stop_distances.Rd index 13c8c670..3f4436ba 100644 --- a/man/stop_distances.Rd +++ b/man/stop_distances.Rd @@ -25,7 +25,7 @@ among all stops for large feeds should be avoided. \dontrun{ library(dplyr) -nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(nyc_path) nyc$stops \%>\% diff --git a/man/stop_group_distances.Rd b/man/stop_group_distances.Rd index 4c7d71e1..99fdbada 100644 --- a/man/stop_group_distances.Rd +++ b/man/stop_group_distances.Rd @@ -24,7 +24,7 @@ By default calculates distances among stop_ids with the same stop_name. \dontrun{ library(dplyr) -nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(nyc_path) stop_group_distances(nyc$stops) diff --git a/man/travel_times.Rd b/man/travel_times.Rd index 36edccda..5fe1a826 100644 --- a/man/travel_times.Rd +++ b/man/travel_times.Rd @@ -96,7 +96,7 @@ all(tts1 == tts2) # 2) separate filtering and travel time calculation for a more granular analysis # stop_names in this feed are not restricted to an area, create clusters of stops to fix -nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(nyc_path) nyc <- cluster_stops(nyc, group_col = "stop_name", cluster_colname = "stop_name") diff --git a/man/validate_gtfs.Rd b/man/validate_gtfs.Rd index d2408753..20715fec 100644 --- a/man/validate_gtfs.Rd +++ b/man/validate_gtfs.Rd @@ -74,7 +74,7 @@ validate_gtfs(gtfs_duke) #> # 2 more variables: validation_status , validation_details \dontrun{ -local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") gtfs <- read_gtfs(local_gtfs_path) attr(gtfs, "validation_result") diff --git a/tests/testthat/test-read-gtfs.R b/tests/testthat/test-read-gtfs.R index d7d3f92d..7235bfff 100644 --- a/tests/testthat/test-read-gtfs.R +++ b/tests/testthat/test-read-gtfs.R @@ -14,7 +14,7 @@ test_that("read_gtfs() imports a local file to a list of test_that("reading a real feed", { skip_on_cran() - g_nyc_path = system.file("extdata", "google_transit_nyc_subway.zip", + g_nyc_path = system.file("extdata", "nyc_subway.zip", package = "tidytransit") gtfs_obj = read_gtfs(g_nyc_path) diff --git a/tests/testthat/test-spatial.R b/tests/testthat/test-spatial.R index 18254012..d166a811 100644 --- a/tests/testthat/test-spatial.R +++ b/tests/testthat/test-spatial.R @@ -149,7 +149,7 @@ test_that("stop_group_distances", { test_that("stop_group_distances real feed", { skip_on_cran() - g_nyc = read_gtfs(system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")) + g_nyc = read_gtfs(system.file("extdata", "nyc_subway.zip", package = "tidytransit")) x1 = stop_group_distances(g_nyc$stops) @@ -170,7 +170,7 @@ test_that("stop_group_distances real feed", { test_that("stops cluster", { skip_on_cran() - g_nyc = read_gtfs(system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")) + g_nyc = read_gtfs(system.file("extdata", "nyc_subway.zip", package = "tidytransit")) g_nyc2 <- filter_feed_by_area(g_nyc, c(-74.0144, 40.7402, -73.9581, 40.7696)) x1 = cluster_stops(g_nyc2$stops) diff --git a/tests/testthat/test-travel_times.R b/tests/testthat/test-travel_times.R index fcce5607..1852ed25 100644 --- a/tests/testthat/test-travel_times.R +++ b/tests/testthat/test-travel_times.R @@ -158,7 +158,7 @@ test_that("feed without transfers", { test_that("nyc feed", { skip_on_cran() - nyc_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") + nyc_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(nyc_path) .child_index = which(nyc$stops$location_type == 0) diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 820687a0..47aedebe 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -80,7 +80,7 @@ test_that("filter_feed with shapes", { test_that("filter_feed_by_date", { skip_on_cran() - g0 = read_gtfs(system.file("extdata", "google_transit_nyc_subway.zip", + g0 = read_gtfs(system.file("extdata", "nyc_subway.zip", package = "tidytransit")) g1 = filter_feed_by_date(g0, "2018-06-28") g2 = filter_feed_by_date(g0, "2018-10-30") diff --git a/vignettes/frequency.Rmd b/vignettes/frequency.Rmd index 6605b101..8abe8642 100644 --- a/vignettes/frequency.Rmd +++ b/vignettes/frequency.Rmd @@ -24,7 +24,7 @@ options(dplyr.summarise.inform=F) ## Introduction The focus of this vignette is on how to use R to make graphics about where and how often -transit service operates based on schedule data published in the [General Transit Feed Specification](https://gtfs.org/). +transit services operate based on schedule data published in the [General Transit Feed Specification](https://gtfs.org/). We'll focus on the New York City Metropolitan Transit Agency's Subway schedule for this vignette, but you can easily apply it to thousands of other GTFS data sources. See the [tidytransit introductory vignette](https://r-transit.github.io/tidytransit/articles/introduction.html#finding-more-gtfs-feeds) @@ -50,12 +50,13 @@ We'll start by importing a snapshot of the NYC MTA's subway schedule, which is i with the package when [installed](https://r-transit.github.io/tidytransit/index.html#installation). ```{r} -local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") gtfs <- read_gtfs(local_gtfs_path) ``` But note that you can also just uncomment the line below and import the data from the NYC -MTA's URL directly. +MTA's URL directly. Note that some routes and services have been removed from the exmaple feed +to reduce package size. ```{r} # gtfs <- read_gtfs("http://web.mta.info/developers/data/nyct/subway/google_transit.zip") @@ -65,10 +66,10 @@ MTA's URL directly. GTFS feeds typically contain a schedule of all the schedules of service for a given system. Selecting a schedule of service in NYC allows us to focus on, for example, non-holiday -weekday service, in the Fall of 2019. In some feeds, service selection can be more or less +weekday service, in the Fall of 2018. In some feeds, service selection can be more or less complicated than NYC. In any case, you'll want to read the [service patterns](https://r-transit.github.io/tidytransit/articles/servicepatterns.html) vignette included in this package in order to see how you can select the right service for -your needs. +your needs. We use one of the functions described in that vignette to create a table on the gtfs feed that lets us filter by weekday/weekend service. @@ -171,7 +172,7 @@ system on weekdays. ```{r} am_stop_freq <- get_stop_frequency(gtfs, start_time = 6*3600, end_time = 10*3600, - service_ids = service_ids, by_route = TRUE) + service_ids = service_ids, by_route = TRUE) ``` ```{r} @@ -196,7 +197,7 @@ stop_name. ```{r} one_line_stops <- am_stop_freq %>% - filter(route_id == 1 & direction_id == 0) %>% + filter(route_id == "1" & direction_id == 0) %>% left_join(gtfs$stops, by ="stop_id") %>% mutate(mean_headway_minutes = mean_headway/60) ``` @@ -295,7 +296,7 @@ routes_sf <- routes_sf %>% And finally, lets plot the routes with median headways of less than 10 minutes in the morning. -```{r, fig.width=6, fig.height=10, warn=FALSE} +```{r, fig.width=6, fig.height=8, warn=FALSE} # convert to an appropriate coordinate reference system routes_sf_crs <- sf::st_transform(routes_sf, 26919) routes_sf_crs %>% @@ -337,7 +338,7 @@ routes_sf_buffer <- st_buffer(routes_sf, Next, when we render the map, we'll make sure to make the borders around each route transparent, and set the opacity for the fill of all the polygons high again. -```{r, fig.width=6, fig.height=10} +```{r, fig.width=6, fig.height=7} routes_sf_buffer %>% ggplot() + geom_sf(colour = alpha("white", 0), fill = alpha("red",0.2)) + @@ -378,7 +379,7 @@ am_stop_name_departures <- am_stop_name_departures %>% Finally, we can plot both the route line counts and the stop departure counts on one map: -```{r, fig.width=6, fig.height=10} +```{r, fig.width=6, fig.height=7} ggplot() + geom_sf(data = routes_sf_buffer, colour = alpha("white",0), fill = alpha("red",0.3)) + diff --git a/vignettes/introduction.Rmd b/vignettes/introduction.Rmd index cd2f70e9..def0e451 100644 --- a/vignettes/introduction.Rmd +++ b/vignettes/introduction.Rmd @@ -62,9 +62,9 @@ a list of the tables in each feed. Below we use the tidytransit `read_gtfs` function in order to read a feed from the NYC MTA into R. -We use a feed included in the package in the example below. But note that you can read +We use an example feed included in the package in the example below. But note that you can read directly from the New York City Metropolitan Transit Authority, as shown in the commented -code below. +code below. You can also read from any other URL. This is useful because there are many sources for GTFS data, and often the best source is transit service providers themselves. See the next @@ -74,7 +74,7 @@ section on "Finding More GTFS Feeds" for more sources of feeds. # nyc <- read_gtfs("http://web.mta.info/developers/data/nyct/subway/google_transit.zip") local_gtfs_path <- system.file("extdata", - "google_transit_nyc_subway.zip", + "nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(local_gtfs_path) ``` @@ -187,9 +187,9 @@ MobilityData_sf = MobilityData_feedlist %>% ungroup() %>% st_as_sf() ``` -Now show the feeds on a map: +These boxes could now be shown on an interactive map. -```{r, fig.width=7} +```{r, fig.width=7, eval=FALSE} library(leaflet) leaflet() %>% addProviderTiles(provider = providers$CartoDB.Positron) %>% @@ -197,4 +197,3 @@ leaflet() %>% fillOpacity = 0.1, label = substr(MobilityData_sf$provider, 0, 60)) ``` - diff --git a/vignettes/servicepatterns.Rmd b/vignettes/servicepatterns.Rmd index 408ee980..574c615b 100644 --- a/vignettes/servicepatterns.Rmd +++ b/vignettes/servicepatterns.Rmd @@ -20,7 +20,7 @@ knitr::opts_chunk$set(echo = TRUE) ## Overview -Each trip in a GTFS feed is referenced to a service_id (in trips.txt). The [GTFS reference](https://gtfs.org/documentation/schedule/reference/#calendartxt) +Each trip in a GTFS feed is referenced to a service_id (in `trips.txt`). The [GTFS reference](https://gtfs.org/documentation/schedule/reference/#calendartxt) specifies that a "service_id contains an ID that uniquely identifies a set of dates when service is available for one or more routes". A service could run on every weekday or only on Saturdays for example. Other possible services run only on holidays during a year, @@ -35,10 +35,11 @@ trip frequencies for different days. ## Prepare data We use a feed from the New York Metropolitan Transportation Authority. It is provided -as a sample feed with tidytransit but you can read it directly from the MTA's website. +as a sample feed with tidytransit but you can read it directly from the MTA's website. Note +that some routes and services have been removed from the feed to reduce package size. ```{r} -local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") gtfs <- read_gtfs(local_gtfs_path) # gtfs <- read_gtfs("http://web.mta.info/developers/data/nyct/subway/google_transit.zip") ``` @@ -99,14 +100,14 @@ patterns (like `dates_services`). We can compare the number of service patterns ```{r} head(gtfs$.$dates_servicepatterns) -# service ids used -n_services <- length(unique(gtfs$trips$service_id)) # 70 +# number of service ids used +n_services <- length(unique(gtfs$trips$service_id)) # 52 # unique date patterns -n_servicepatterns <- length(unique(gtfs$.$servicepatterns$servicepattern_id)) # 7 +n_servicepatterns <- length(unique(gtfs$.$servicepatterns$servicepattern_id)) # 3 ``` -The feed uses 70 service_ids but there are actually only 7 different date patterns. Other +The example feed uses 52 service_ids but there are actually only 3 different date patterns. Other feeds might not have such low numbers, for example the [Swiss GTFS feed](https://opentransportdata.swiss/dataset/timetable-2019-gtfs) uses around 15'600 service_ids which all identify unique date patterns. @@ -124,10 +125,9 @@ ggplot(date_servicepattern_table) + theme_bw() + scale_x_date(breaks = scales::date_breaks("1 month")) + theme(legend.position = "bottom") ``` -The plot shows that pattern `s_128de43` runs on every Sunday from July until October without -exceptions. `s_a4c6b26` also runs on Sundays but it also covers a Monday (September 3rd). -Similarly, the date pattern `s_f3bcc6f` runs every Saturday. `s_d7d9701` covers weekdays -(Mondays through Friday), `s_e25d6ca` seems to do the same through November with some exceptions. +The plot shows that pattern `s_a4c6b26` runs on every Sunday from July until October. +`s_c578d4a` runs every Saturday and on one Wednesday. +`s_e25d6ca` covers weekdays (Mondays through Friday) with one exception. ### Names for service patterns diff --git a/vignettes/timetable.Rmd b/vignettes/timetable.Rmd index a456ea86..0c6316e9 100644 --- a/vignettes/timetable.Rmd +++ b/vignettes/timetable.Rmd @@ -26,7 +26,7 @@ We use a feed from the New York Metropolitan Transportation Authority. It is pro sample feed with tidytransit but you can read it directly from the MTA's website. ```{r} -local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") +local_gtfs_path <- system.file("extdata", "nyc_subway.zip", package = "tidytransit") gtfs <- read_gtfs(local_gtfs_path) # gtfs <- read_gtfs("http://web.mta.info/developers/data/nyct/subway/google_transit.zip") ``` @@ -199,7 +199,7 @@ ggplot(departures_180823) + theme_bw() + Now we plot departures for all stop_ids with the same name, so we can separate for different stop_ids. The following plot shows all departures for stop_ids 127N and 127S from 7 to 8 AM. -```{r fig.width=6, fig.height=6} +```{r fig.width=7, fig.height=5} departures_180823_sub_7to8 <- departures_180823 %>% filter(stop_id %in% c("127N", "127S")) %>% filter(departure_time >= hms::hms(hours = 7) & departure_time <= hms::hms(hours = 8))