This function takes a city normal city name as an input argument and returns all airports associated with that city. Airports are typically associated with their local metropolitan area but some exceptions may be present in the data. If there are no matching results in the data for the city argument, a list of closely named alternatives will be suggested with a warning.

city_airports(city, country)

Arguments

city

A city name. If no exact match will attempt to prompt user with suggested alternatives

country

(Optional) A country name or ISO country code in either numeric, alpha-2, or alpha 3 format. Case insensitive.

Value

A Nx17 tibble with airport details where n is the number of airports serving that city

Examples

city_airports("Vancouver")
#> # A tibble: 5 x 17 #> `OpenFlights ID` Name City IATA ICAO Country `Country Code` #> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 156 Vanc… Vanc… "YVR" CYVR Canada 124 #> 2 4107 Coal… Vanc… "\\N" CAQ3 Canada 124 #> 3 5500 Vanc… Vanc… "CXH" CYHC Canada 124 #> 4 12090 Vanc… Vanc… "\\N" CAM9 Canada 124 #> 5 13022 Harb… Vanc… "\\N" CBC7 Canada 124 #> # … with 10 more variables: `Country Code (Alpha-2)` <chr>, `Country Code #> # (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>, Altitude <dbl>, #> # UTC <dbl>, DST <chr>, Timezone <chr>, Type <chr>, Source <chr>
city_airports("London")
#> Warning: Input city matches cities in multiple countries. Do you want to specify a country argument? See documentation ?city_airports for details.
#> # A tibble: 9 x 17 #> `OpenFlights ID` Name City IATA ICAO Country `Country Code` #> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 174 Lond… Lond… "YXU" CYXU Canada 124 #> 2 492 Lond… Lond… "LTN" EGGW United… 826 #> 3 502 Lond… Lond… "LGW" EGKK United… 826 #> 4 503 Lond… Lond… "LCY" EGLC United… 826 #> 5 507 Lond… Lond… "LHR" EGLL United… 826 #> 6 548 Lond… Lond… "STN" EGSS United… 826 #> 7 7722 Lond… Lond… "\\N" EGLW United… 826 #> 8 8410 Lond… Lond… "LOZ" KLOZ United… 840 #> 9 10169 Madi… Lond… "\\N" KUYF United… 840 #> # … with 10 more variables: `Country Code (Alpha-2)` <chr>, `Country Code #> # (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>, Altitude <dbl>, #> # UTC <dbl>, DST <chr>, Timezone <chr>, Type <chr>, Source <chr>
city_airports("London","Canada")
#> # A tibble: 1 x 17 #> `OpenFlights ID` Name City IATA ICAO Country `Country Code` #> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 174 Lond… Lond… YXU CYXU Canada 124 #> # … with 10 more variables: `Country Code (Alpha-2)` <chr>, `Country Code #> # (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>, Altitude <dbl>, #> # UTC <dbl>, DST <chr>, Timezone <chr>, Type <chr>, Source <chr>
city_airports("London","CA")
#> # A tibble: 1 x 17 #> `OpenFlights ID` Name City IATA ICAO Country `Country Code` #> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 174 Lond… Lond… YXU CYXU Canada 124 #> # … with 10 more variables: `Country Code (Alpha-2)` <chr>, `Country Code #> # (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>, Altitude <dbl>, #> # UTC <dbl>, DST <chr>, Timezone <chr>, Type <chr>, Source <chr>
city_airports("London","CAN")
#> # A tibble: 1 x 17 #> `OpenFlights ID` Name City IATA ICAO Country `Country Code` #> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 174 Lond… Lond… YXU CYXU Canada 124 #> # … with 10 more variables: `Country Code (Alpha-2)` <chr>, `Country Code #> # (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>, Altitude <dbl>, #> # UTC <dbl>, DST <chr>, Timezone <chr>, Type <chr>, Source <chr>
city_airports("London","124")
#> # A tibble: 1 x 17 #> `OpenFlights ID` Name City IATA ICAO Country `Country Code` #> <dbl> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 174 Lond… Lond… YXU CYXU Canada 124 #> # … with 10 more variables: `Country Code (Alpha-2)` <chr>, `Country Code #> # (Alpha-3)` <chr>, Latitude <dbl>, Longitude <dbl>, Altitude <dbl>, #> # UTC <dbl>, DST <chr>, Timezone <chr>, Type <chr>, Source <chr>