Package tidytransit. March 4, 2019

Similar documents
Package fastdummies. January 8, 2018

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package jpmesh. December 4, 2017

Package canvasxpress

Package validara. October 19, 2017

Package bikedata. April 27, 2018

Package cancensus. February 4, 2018

Package statsdk. September 30, 2017

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package calpassapi. August 25, 2018

Package rgho. R topics documented: January 18, 2017

Package facerec. May 14, 2018

Package sfdct. August 29, 2017

Package dkanr. July 12, 2018

Package qualmap. R topics documented: September 12, Type Package

Package censusr. R topics documented: June 14, Type Package Title Collect Data from the Census API Version 0.0.

Package ECctmc. May 1, 2018

Package robotstxt. November 12, 2017

Package rbgm. May 18, 2018

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package docxtools. July 6, 2018

Package githubinstall

Package messaging. May 27, 2018

Package opencage. January 16, 2018

Package SEMrushR. November 3, 2018

Package tidylpa. March 28, 2018

Package oec. R topics documented: May 11, Type Package

Package rzeit2. January 7, 2019

Package datasets.load

Package bisect. April 16, 2018

Package ezsummary. August 29, 2016

Package mapsapi. March 12, 2018

Package postal. July 27, 2018

Package tidyimpute. March 5, 2018

Package raker. October 10, 2017

Package geogrid. August 19, 2018

Package postgistools

Package fitbitscraper

Package queuecomputer

Package omu. August 2, 2018

Package rcv. August 11, 2017

Package projector. February 27, 2018

Package driftr. June 14, 2018

Package rpostgislt. March 2, 2018

Package rsppfp. November 20, 2018

Package embed. November 19, 2018

Package GetHFData. November 28, 2017

Package knitrprogressbar

Package TrafficBDE. March 1, 2018

Package wikitaxa. December 21, 2017

Package splithalf. March 17, 2018

Package osmdata. February 22, 2018

Package ecoseries. R topics documented: September 27, 2017

Package vip. June 15, 2018

Package anomalize. April 17, 2018

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package nngeo. September 29, 2018

Package guardianapi. February 3, 2019

Package crossword.r. January 19, 2018

Package nlgeocoder. October 8, 2018

Package gtrendsr. October 19, 2017

Package WordR. September 7, 2017

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package vinereg. August 10, 2018

Package censusapi. August 19, 2018

Package comparedf. February 11, 2019

Package sfc. August 29, 2016

Package eply. April 6, 2018

Package IsoCorrectoR. R topics documented:

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package liftr. R topics documented: May 14, Type Package

Package utilsipea. November 13, 2017

Package condusco. November 8, 2017

Package fastqcr. April 11, 2017

Package data.world. April 5, 2018

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package repec. August 31, 2018

Package editdata. October 7, 2017

Package rmapzen. October 7, 2018

Package tidytree. June 13, 2018

Package areal. December 31, 2018

Package gtrendsr. August 4, 2018

Package lumberjack. R topics documented: July 20, 2018

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package RODBCext. July 31, 2017

Package internetarchive

Package keyholder. May 19, 2018

Package darksky. September 20, 2017

Package xtractomatic

Package NFP. November 21, 2016

Package nyctaxi. October 26, 2017

Package condformat. October 19, 2017

Package rnrfa. April 13, 2018

Package wrswor. R topics documented: February 2, Type Package

Package transformr. December 9, 2018

Package pmatch. October 19, 2018

Package statar. July 6, 2017

Package GetITRData. October 22, 2017

Package balance. October 12, 2018

Package skynet. December 12, 2018

Transcription:

Type Package Package tidytransit March 4, 2019 Title Read, Validate, Analyze, and Map Files in the General Transit Feed Specification Version 0.3.8 Read General Transit Feed Specification (GTFS) zipfiles into a list of R dataframes. Perform validation of the data structure against the specification. Analyze the headways and frequencies at routes and stops. Create maps and perform spatial analysis on the routes and stops. Please see the GTFS documentation here for more detail: <http://gtfs.org/>. License GPL LazyData TRUE Depends R (>= 3.2.5) Imports dplyr, zip, tibble, readr, data.table, httr, htmltools, magrittr, stringr, assertthat, scales, here, rlang, sf, lubridate, hms, tidyr, tools Suggests testthat, knitr, rmarkdown RoxygenNote 6.1.1 URL https://github.com/r-transit/tidytransit BugReports https://github.com/r-transit/tidytransit VignetteBuilder knitr Encoding UTF-8 NeedsCompilation no Author Tom Buckley [aut, cre], Danton Noriega-Goodwin [aut], Flavio Poletti [aut], Angela Li [aut], Mark Padgham [aut], Elaine McVey [ctb], Charles Hans Thompson [ctb], Michael Sumner [ctb], Patrick Hausmann [ctb], 1

2 feedlist_df Bob Rudis [ctb], Kearey Smith [ctb], Dave Vautin [ctb], Kyle Walker [ctb] Maintainer Tom Buckley <tom@tbuckl.com> Repository CRAN Date/Publication 2019-03-04 12:00:03 UTC R topics documented: feedlist_df.......................................... 2 filter_stops.......................................... 3 get_date_service_table................................... 4 get_feedlist......................................... 4 get_route_frequency.................................... 5 get_route_geometry..................................... 6 get_stop_frequency..................................... 6 get_stop_geometry..................................... 7 gtfs_as_sf.......................................... 8........................................... 8 import_gtfs......................................... 9 plot.gtfs........................................... 10 read_gtfs.......................................... 10 routes_df_as_sf....................................... 11 route_type_names_df.................................... 12 set_api_key......................................... 12 stops_df_as_sf........................................ 13 Index 14 feedlist_df Dataframe of source GTFS data from Transitfeeds A dataset containing a list of URLs for GTFS feeds feedlist_df

filter_stops 3 Format A data frame with 911 rows and 10 variables: id the id of the feed on transitfeeds.com t title of the feed loc_id location id loc_pid location placeid of the feed on transitfeeds.com loc_t the title of the location loc_n the shortname fo the location loc_lat the location latitude loc_lng the location longitude url_d GTFS feed url url_i the metadata url for the feed Source http://www.transitfeeds.com/ filter_stops Get a set of stops for a given set of service ids and route ids Get a set of stops for a given set of service ids and route ids filter_stops(, service_ids, route_ids) service_ids route_ids as read by read_gtfs() the service for which to get stops the route_ids for which to get stops stops for a given service local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(local_gtfs_path,local=true) select_service_id <- filter(nyc$calendar, monday==1) %>% pull(service_id) select_route_id <- sample_n(nyc$routes, 1) %>% pull(route_id) filtered_stops_df <- filter_stops(nyc, select_service_id, select_route_id)

4 get_feedlist get_date_service_table Returns all possible date/service_id combinations as a data frame Use it to summarise service. For example, get a count of the number of services for a date. See example. get_date_service_table() a ect as read by read_gtfs a date_service data frame library(dplyr) local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(local_gtfs_path, local=true) nyc_services_by_date <- nyc %>% get_date_service_table() # count the number of services running on each date nyc_services_by_date %>% group_by(date) %>% count() get_feedlist Get list of all available feeds from transitfeeds API Get list of all available feeds from transitfeeds API get_feedlist() a data frame with the gtfs feeds on transitfeeds.

get_route_frequency 5 See Also feedlist_df feedlist_df <- get_feedlist() get_route_frequency Get Route Frequency should take: get_route_frequency(, start_hour = 6, end_hour = 22, quiet = FALSE, service_id = "", dow = c(1, 1, 1, 1, 1, 0, 0)) start_hour end_hour quiet service_id dow a list of gtfs dataframes as read by the trread package. (optional) an integer, default 6 (6 am) (optional) an integer, default 22 (10 pm) default FALSE. whether to echo process messages (optional) a string from the calendar dataframe identifying a particular service schedule. (optional) an integeger vector with days of week. monday=1. default: c(1,1,1,1,1,0,0) a with a dataframe of routes with variables for headway/frequency for a route within a given time frame data() <- get_route_frequency() x <- order($routes_frequency$median_headways) head($routes_frequency[x,])

6 get_stop_frequency get_route_geometry Make Routes into Simple Features Lines Make Routes into Simple Features Lines get_route_geometry(, route_ids = NULL, service_ids = NULL) route_ids service_ids tidytransit gtfs object select routes to convert to simple features select service_ids to convert to simple features an sf dataframe for gtfs routes with a multilinestring column data() routes_sf <- get_route_geometry() plot(routes_sf[1,]) get_stop_frequency Get Stop Frequency Get Stop Frequency get_stop_frequency(, start_hour = 6, end_hour = 22, service_id = "", dow = c(1, 1, 1, 1, 1, 0, 0), by_route = TRUE, wide = FALSE)

get_stop_geometry 7 a list of gtfs dataframes as read by read_gtfs(). start_hour (optional) an integer indicating the start hour (default 7) end_hour (optional) an integer indicating the end hour (default 20) service_id dow by_route wide (optional) a string from the calendar dataframe identifying a particular service schedule. (optional) integer vector indicating which days of week to calculate for. default is weekday, e.g. c(1,1,1,1,1,0,0) default TRUE, if FALSE then calculate headway for any line coming through the stop in the same direction on the same schedule. (optional) if true, then return a wide rather than tidy data frame a with a dataframe of stops with a "Trips" variable representing the count trips taken through each stop for a route within a given time frame data() <- get_stop_frequency() x <- order($stops_frequency$headway) head($stops_frequency_df[x,]) get_stop_geometry Make Stops into Simple Features Points Make Stops into Simple Features Points get_stop_geometry(stops) stops a gtfs$stops dataframe an sf dataframe for gtfs routes with a point column

8 data() some_stops <- $stops[sample(nrow($stops), 40),] some_stops_sf <- get_stop_geometry(some_stops) plot(some_stops_sf) gtfs_as_sf Add Simple Features for Stops and Routes to GTFS Object Add Simple Features for Stops and Routes to GTFS Object gtfs_as_sf(, quiet) quiet a standard tidytransit gtfs object boolean whether to print status messages a tidytransit gtfs object with a bunch of simple features tables Example GTFS data Data obtained from http://data.trilliumtransit.com/gtfs/duke-nc-us/duke-nc-us.zip. Format An object of class gtfs of length 22. See Also read_gtfs

import_gtfs 9 import_gtfs This function is deprecated. Please use read_gtfs This function reads GTFS text files from a local or remote zip file. It also validates the files against the GTFS specification by file, requirement status, and column name The data are returned as a list of dataframes and a validation object, which contains details on whether all required files were found, and which required and optional columns are present. import_gtfs(path, local = FALSE, quiet = FALSE) path local quiet Character. url link to zip file OR path to local zip file. if to local path, then option local must be set to TRUE. Boolean. If the paths are searching locally or not. Default is FALSE (that is, urls). Boolean. Whether to see file download progress and files extract. FALSE by default. Dataframes of GTFS data. library(dplyr) u1 <- "https://github.com/r-transit/tidytransit/raw/master/inst/extdata/sample-feed-fixed.zip" sample_gtfs <- import_gtfs(u1) attach(sample_gtfs) #list routes by the number of stops they have routes %>% inner_join(trips, by="route_id") %>% inner_join(stop_times) %>% inner_join(stops, by="stop_id") %>% group_by(route_long_name) %>% summarise(stop_count=n_distinct(stop_id)) %>% arrange(desc(stop_count))

10 read_gtfs plot.gtfs Plot GTFS object routes and their frequencies Plot GTFS object routes and their frequencies ## S3 method for class 'gtfs' plot(x,...) x a as read by read_gtfs()... further specifications local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") nyc <- read_gtfs(local_gtfs_path, local=true) plot(nyc) read_gtfs Get and validate dataframes of General Transit Feed Specification (GTFS) data. This function reads GTFS text files from a local or remote zip file. It also validates the files against the GTFS specification by file, requirement status, and column name The data are returned as a list of dataframes and a validation object, which contains details on whether all required files were found, and which required and optional columns are present. read_gtfs(path, local = FALSE, quiet = TRUE, geometry = FALSE, frequency = FALSE)

routes_df_as_sf 11 path local quiet geometry frequency Character. url link to zip file OR path to local zip file. if to local path, then option local must be set to TRUE. Boolean. If the paths are searching locally or not. Default is FALSE (that is, urls). Boolean. Whether to see file download progress and files extract. FALSE by default. Boolean. Whether to add simple feature dataframes of routes and stops to the gtfs object Boolean. Whether to add frequency/headway calculations to the gtfs object A GTFS object. That is, a list of dataframes of GTFS data. library(dplyr) u1 <- "https://github.com/r-transit/tidytransit/raw/master/inst/extdata/sample-feed-fixed.zip" sample_gtfs <- read_gtfs(u1) attach(sample_gtfs) #list routes by the number of stops they have routes %>% inner_join(trips, by="route_id") %>% inner_join(stop_times) %>% inner_join(stops, by="stop_id") %>% group_by(route_long_name) %>% summarise(stop_count=n_distinct(stop_id)) %>% arrange(desc(stop_count)) routes_df_as_sf This function is deprecated. Please use get_route_geometry Make Routes into Simple Features Lines This function is deprecated. Please use get_route_geometry Make Routes into Simple Features Lines routes_df_as_sf(, route_ids = NULL, service_ids = NULL)

12 set_api_key route_ids service_ids gtfs object select routes to convert to simple features select service_ids to convert to simple features an sf dataframe for gtfs routes with a multilinestring column data() routes_sf <- get_route_geometry() plot(routes_sf[1,]) route_type_names_df Dataframe of route type id s and the names of the types (e.g. "Cable Car") Dataframe of route type id s and the names of the types (e.g. "Cable Car") route_type_names_df Format A data frame with 122 rows and 2 variables: id the id of route type name name of the gtfs route type Source https://gist.github.com/derhuerst/b0243339e22c310bee2386388151e11e set_api_key Set TransitFeeds API key for recall Set TransitFeeds API key for recall set_api_key()

stops_df_as_sf 13 stops_df_as_sf This function is deprecated. Please use get_stop_geometry Make Stops into Simple Features Points This function is deprecated. Please use get_stop_geometry Make Stops into Simple Features Points stops_df_as_sf(stops) stops a gtfs$stops dataframe an sf dataframe for gtfs routes with a point column data() some_stops <- $stops[sample(nrow($stops), 40),] some_stops_sf <- get_stop_geometry(some_stops) plot(some_stops_sf)

Index Topic datasets feedlist_df, 2, 8 route_type_names_df, 12 feedlist_df, 2 filter_stops, 3 get_date_service_table, 4 get_feedlist, 4 get_route_frequency, 5 get_route_geometry, 6 get_stop_frequency, 6 get_stop_geometry, 7 gtfs_as_sf, 8, 8 import_gtfs, 9 plot.gtfs, 10 read_gtfs, 10 route_type_names_df, 12 routes_df_as_sf, 11 set_api_key, 12 stops_df_as_sf, 13 14