Travel Plans

Author

Tingting Zhan

Published

August 23, 2025

1 Introduction

This vignette of R package iata (Github, RPubs) documents …

R terminology might be different from that of mathematics and statistics. Please refer to Section 5 for explanation and reference of the terms and abbreviations used in this vignette.

Package iata Imports packages

1.1 Prerequisite

Package iata requires R version 4.5.0 (released 2025-04-11) or higher (macOS, Windows). An Integrated Development Environment (IDE), e.g., RStudio (Posit team 2025) or Positron, is not required, but highly recommended. This vignette is created under R version 4.5.1 (2025-06-13) using packages knitr (Xie 2025, v1.50), quarto (Allaire and Dervieux 2024, v1.5.0 with Quarto v1.7.33) and rmarkdown (Allaire et al. 2024, v2.29).

Environment on author’s computer
Sys.info()[c('sysname', 'release', 'machine')]
#  sysname  release  machine 
# "Darwin" "25.0.0"  "arm64"
R.version
#                _                           
# platform       aarch64-apple-darwin20      
# arch           aarch64                     
# os             darwin20                    
# system         aarch64, darwin20           
# status                                     
# major          4                           
# minor          5.1                         
# year           2025                        
# month          06                          
# day            13                          
# svn rev        88306                       
# language       R                           
# version.string R version 4.5.1 (2025-06-13)
# nickname       Great Square Root

Experimental (and maybe unstable) features are released extremely frequently to Github. Active developers should use the Github version; suggestions and bug reports are welcome!

remotes::install_github('tingtingzhan/iata')

1.2 Getting Started

Examples in this vignette require that the search path has

library(iata)

2 Flight Path

A mileage run.

tripA = 'YYZ-YOW-YFB-YAB-YRB-YGZ, YGZ-YRB-YAB-YFB-YVP-YUL-YYZ' |>
  IATA()
tripA
#            Miles Kilometer
# YYZ ✈ YOW  225.9     363.5
# YOW ✈ YFB 1304.8    2099.9
# YFB ✈ YAB  761.4    1225.3
# YAB ✈ YRB  224.8     361.8
# YRB ✈ YGZ  239.2     385.0
# 
#           Miles Kilometer
# YGZ ✈ YRB 239.2     385.0
# YRB ✈ YAB 224.8     361.8
# YAB ✈ YFB 761.4    1225.3
# YFB ✈ YVP 391.9     630.8
# YVP ✈ YUL 901.8    1451.3
# YUL ✈ YYZ 315.1     507.1
# 
# Total Mileage: 5590.4
tripA |> 
  plot()

Another mileage run.

tripB = 'SFO-HNL-MAJ-KWA-KSA-PNI-TKK-GUM-ROR-MNL-NRT-KIX-HND-SFO' |>
  IATA()
tripB
#            Miles Kilometer
# SFO ✈ HNL 2398.5    3860.0
# HNL ✈ MAJ 2279.6    3668.7
# MAJ ✈ KWA  267.9     431.1
# KWA ✈ KSA  401.0     645.3
# KSA ✈ PNI  345.2     555.6
# PNI ✈ TKK  438.1     705.0
# TKK ✈ GUM  633.1    1018.9
# GUM ✈ ROR  814.0    1310.1
# ROR ✈ MNL 1040.9    1675.1
# MNL ✈ NRT 1892.8    3046.2
# NRT ✈ KIX  306.2     492.8
# KIX ✈ HND  269.5     433.7
# HND ✈ SFO 5160.2    8304.5
# 
# Total Mileage: 16247.1
tripB |> 
  plot()

3 Airline Status

JSM24 = new(
  Class = 'airfare', 
  carrier = 'AA', 
  depart = 'PHL', arrive = 'PDX', 
  code = 'J', currency = 'usd', 
  basefare = 276.28, tax = 35.82, upgrade = 241.88
)
JSM24
# American Airlines🇺🇸
# PHL ✈ PDX
# 2406.2 Miles
# Booking Code: J
# Base Fare: 💵$276.28
# Tax: 💵$35.82
# Upgrade Fee: 💵$241.88
JSM24 |> 
  earnAA()

JSM24 |> 
  earnAS()

Before Alaska Airlines devaluation 2025
JSM24 |> 
  earnASold()

JSM24 |> 
  earnBA()

Before British Airlines devaluation 2024
JSM24 |> 
  earnBAold()

4 Small Map

'EWR-PHL-JFK-IAD' |> 
  IATA() |> 
  as.leaflet()

5 Terms & Abbreviations

Term / Abbreviation Description
CRAN, R The Comprehensive R Archive Network, https://cran.r-project.org
Depends, Imports, Suggests, Enhances Writing R Extensions, Section 1.1.3 Package Dependencies
|> Forward pipe operator introduced since R version 4.1.0
attr, attributes Attributes
data.frame Data frame
S3, generic, methods S3 object oriented system, UseMethod; getS3method; https://adv-r.hadley.nz/s3.html
S4, generic, methods S4 object oriented system, isS4; setClass; setMethod; getMethod; https://adv-r.hadley.nz/s4.html

6 References

Allaire, JJ, and Christophe Dervieux. 2024. quarto: R Interface to ’Quarto’ Markdown Publishing System. https://doi.org/10.32614/CRAN.package.quarto.
Allaire, JJ, Yihui Xie, Christophe Dervieux, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, et al. 2024. rmarkdown: Dynamic Documents for r. https://github.com/rstudio/rmarkdown.
Cameron, Allan, and Teun van den Brand. 2025. geomtextpath: Curved Text in ’ggplot2. https://doi.org/10.32614/CRAN.package.geomtextpath.
Cheng, Joe, Barret Schloerke, Bhaskar Karambelkar, and Yihui Xie. 2024. leaflet: Create Interactive Web Maps with the JavaScript ’Leaflet’ Library. https://doi.org/10.32614/CRAN.package.leaflet.
Csárdi, Gábor. 2025. cli: Helpers for Developing Command Line Interfaces. https://doi.org/10.32614/CRAN.package.cli.
Hijmans, Robert J. 2024. geosphere: Spherical Trigonometry. https://doi.org/10.32614/CRAN.package.geosphere.
Posit team. 2025. RStudio: Integrated Development Environment for r. Boston, MA: Posit Software, PBC. http://www.posit.co/.
Sievert, Carson. 2020. Interactive Web-Based Data Visualization with r, Plotly, and Shiny. Chapman; Hall/CRC. https://plotly-r.com.
Wickham, Hadley. 2016. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. https://ggplot2.tidyverse.org.
Wickham, Hadley, Thomas Lin Pedersen, and Dana Seidel. 2025. scales: Scale Functions for Visualization. https://doi.org/10.32614/CRAN.package.scales.
Xie, Yihui. 2025. knitr: A General-Purpose Package for Dynamic Report Generation in R. https://yihui.org/knitr/.