Package 'naptanr'

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

Help Index


Call the NaPTAN API for all, or for specified ATCO codes. Returns a data frame of Naptan data.

Description

Call the NaPTAN API for all, or for specified ATCO codes. Returns a data frame of Naptan data.

Usage

call_naptan(atco = NULL)

Arguments

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.

Value

Returns a data frame of NaPTAN data containing transport access node information. See NaPTAN data set guidance for more information.

Examples

## 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.

Description

Call the Naptan API for a partial or full region name. Returns a data frame of Naptan data.

Usage

call_naptan_region(region_string)

Arguments

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.

Value

Returns a data frame of NaPTAN data containing transport access node information. See NaPTAN data set guidance for more information.

Examples

#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

Description

Return a vector of all permitted ATCO region codes in NaPTAN

Usage

get_atco_codes()

Return a lookup table of all permitted ATCO codes and area names for a specified area string and/or country

Description

Return a lookup table of all permitted ATCO codes and area names for a specified area string and/or country

Usage

lookup_atco_codes(area_name = "", country = "")

Arguments

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.

Value

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.

Examples

#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")