Title: | Call the 'NaPTAN' API Through R |
---|---|
Description: | An R wrapper for pulling data from the National Public Transport Access Nodes ('NaPTAN') API (<https://www.api.gov.uk/dft/national-public-transport-access-nodes-naptan-api/#national-public-transport-access-nodes-naptan-api>). This allows users to download 'NaPTAN' transport information, for the full dataset, by ATCO region code, or by name of region. |
Authors: | Tom Westlake [aut], Francesca Bryden [aut, cre], Sara Smith [aut] |
Maintainer: | Francesca Bryden <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.1 |
Built: | 2025-02-18 03:55:32 UTC |
Source: | https://github.com/cran/naptanr |
Call the NaPTAN API for all, or for specified ATCO codes. Returns a data frame of Naptan data.
call_naptan(atco = NULL)
call_naptan(atco = NULL)
atco |
string or vector of strings. First three digits of ATCO area codes of interest. If provided, will return data for only these ATCO areas. Defaults to NULL. To return a lookup of current valid ATCO codes, use the lookup_atco_codes() function. |
Returns a data frame of NaPTAN data containing transport access node information. See NaPTAN data set guidance for more information.
## Not run: #Return data for all ATCO areas call_naptan() #Return data for a single ATCO area call_naptan(atco = "050") #Return data for multiple atco codes call_naptan(atco = c("050", "290")) ## End(Not run)
## Not run: #Return data for all ATCO areas call_naptan() #Return data for a single ATCO area call_naptan(atco = "050") #Return data for multiple atco codes call_naptan(atco = c("050", "290")) ## End(Not run)
Call the Naptan API for a partial or full region name. Returns a data frame of Naptan data.
call_naptan_region(region_string)
call_naptan_region(region_string)
region_string |
string of partial or complete region name. Function uses regex to search for provided string in the names of the regions in Naptan. To see a data frame of current valid atco codes and region names, use the lookup_atco_codes() function. |
Returns a data frame of NaPTAN data containing transport access node information. See NaPTAN data set guidance for more information.
#Return data for west yorkshire only call_naptan_region("west yorkshire") #Return data for all yorkshire regions call_naptan_region("yorkshire")
#Return data for west yorkshire only call_naptan_region("west yorkshire") #Return data for all yorkshire regions call_naptan_region("yorkshire")
Return a vector of all permitted ATCO region codes in NaPTAN
get_atco_codes()
get_atco_codes()
Return a lookup table of all permitted ATCO codes and area names for a specified area string and/or country
lookup_atco_codes(area_name = "", country = "")
lookup_atco_codes(area_name = "", country = "")
area_name |
string of partial or complete area name. Default is blank, which returns a full lookup table. |
country |
string of country code ("ENG", "SCO", "WAL" or "GB"). Default is blank, which returns a full lookup table. |
A data frame containing two columns, "AreaName" a character column containing names of geographic regions and AtcoAreaCode, a character column containing corresponding ATCO codes for these areas.
#Return all ATCO codes lookup_atco_codes() #Return Yorkshire ATCO codes lookup_atco_codes(area_name = "yorkshire") #Return ATCO codes in Scotland lookup_atco_codes(country = "SCO")
#Return all ATCO codes lookup_atco_codes() #Return Yorkshire ATCO codes lookup_atco_codes(area_name = "yorkshire") #Return ATCO codes in Scotland lookup_atco_codes(country = "SCO")