# Introduction

The sfo package provides a monthly statistics of San Francisco International (SFO) airport air traffic between July 2005 and December 2020. That includes the following two datasets:

- `sfo_passengers` - air traffic passengers statistics
- `sfo_stats` - air traffic landing statistics

### sfo_passengers

The `sfo_passengers` dataset focusing on monthly air passengers statistics, and it contains the following fields:

- `activity_period` - Activity year and month in YYYYMM format
- `operating_airline` -Airline name for the operator of aircraft
- `operating_airline_iata_code` -The International Air Transport Association (IATA) two-letter designation for the Operating Airline
- `published_airline` -Airline name that issues the ticket and books revenue for passenger activity
- `published_airline_iata_code` -The International Air Transport Association (IATA) two-letter designation for the Published Airline
- `geo_summary` -Designates whether the passenger activity in relation to SFO arrived from or departed to a location within the United States (“domestic”), or outside the United States (“international”) without stops
- `geo_region` -Provides a more detailed breakdown of the GEO Summary field to designate the region in the world where activity in relation to SFO arrived from or departed to without stops
- `activity_type_code` -A description of the physical action a passenger took in relation to a flight, which includes boarding a flight (“enplanements”), getting off a flight (“deplanements”) and transiting to another location (“intransit”)
- `price_category_code` -A categorization of whether a Published Airline is a low-cost carrier or not a low-cost carrier}
- `terminal` -The airport terminal designations at SFO where passenger activity took place
- `boarding_area` -The airport boarding area designations at SFO where passenger activity took place
- `passenger_count` -The number of monthly passengers associated with the above attribute fields

Data source: San Francisco data portal (DataSF) API

    library(sfo)

    data("sfo_passengers")

    str(sfo_passengers)
    #> 'data.frame':    22869 obs. of  12 variables:
    #>  $ activity_period            : int  202012 202012 202012 202012 202012 202012 202012 202012 202012 202012 ...
    #>  $ operating_airline          : chr  "United Airlines" "United Airlines" "United Airlines" "United Airlines" ...
    #>  $ operating_airline_iata_code: chr  "UA" "UA" "UA" "UA" ...
    #>  $ published_airline          : chr  "United Airlines" "United Airlines" "United Airlines" "United Airlines" ...
    #>  $ published_airline_iata_code: chr  "UA" "UA" "UA" "UA" ...
    #>  $ geo_summary                : chr  "Domestic" "Domestic" "International" "International" ...
    #>  $ geo_region                 : chr  "US" "US" "Asia" "Asia" ...
    #>  $ activity_type_code         : chr  "Enplaned" "Thru / Transit" "Deplaned" "Enplaned" ...
    #>  $ price_category_code        : chr  "Other" "Other" "Other" "Other" ...
    #>  $ terminal                   : chr  "Terminal 3" "Terminal 3" "International" "International" ...
    #>  $ boarding_area              : chr  "F" "F" "G" "G" ...
    #>  $ passenger_count            : int  117260 61 12763 16050 2733 2878 3913 3587 11735 585 ...

    head(sfo_passengers)
    #>   activity_period operating_airline operating_airline_iata_code
    #> 1          202012   United Airlines                          UA
    #> 2          202012   United Airlines                          UA
    #> 3          202012   United Airlines                          UA
    #> 4          202012   United Airlines                          UA
    #> 5          202012   United Airlines                          UA
    #> 6          202012   United Airlines                          UA
    #>   published_airline published_airline_iata_code   geo_summary
    #> 1   United Airlines                          UA      Domestic
    #> 2   United Airlines                          UA      Domestic
    #> 3   United Airlines                          UA International
    #> 4   United Airlines                          UA International
    #> 5   United Airlines                          UA International
    #> 6   United Airlines                          UA International
    #>            geo_region activity_type_code price_category_code      terminal
    #> 1                  US           Enplaned               Other    Terminal 3
    #> 2                  US     Thru / Transit               Other    Terminal 3
    #> 3                Asia           Deplaned               Other International
    #> 4                Asia           Enplaned               Other International
    #> 5 Australia / Oceania           Deplaned               Other International
    #> 6 Australia / Oceania           Enplaned               Other International
    #>   boarding_area passenger_count
    #> 1             F          117260
    #> 2             F              61
    #> 3             G           12763
    #> 4             G           16050
    #> 5             G            2733
    #> 6             G            2878

### sfo_stats

The `sfo_stats` dataset focusing on monthly landing statistics, and it contains the following fields:

- `activity_period` - Activity year and month in YYYYMM format
- `operating_airline` -Airline name for the operator of aircraft
- `operating_airline_iata_code` -The International Air Transport Association (IATA) two-letter designation for the Operating Airline
- `published_airline` -Airline name that issues the ticket and books revenue for passenger activity
- `published_airline_iata_code` -The International Air Transport Association (IATA) two-letter designation for the Published Airline
- `geo_summary` -Designates whether the passenger activity in relation to SFO arrived from or departed to a location within the United States (“domestic”), or outside the United States (“international”) without stops
- `geo_region` -Provides a more detailed breakdown of the GEO Summary field to designate the region in the world where activity in relation to SFO arrived from or departed to without stops
- `landing_aircraft_type` - A designation for three types of aircraft that landed at SFO, which includes passenger aircraft, cargo only aircraft (“freighters”) or combination aircraft (“combi”)
- `aircraft_body_type` - A designation that is independent from Landing Aircraft Type, which determines whether commercial aircraft landed at SFO is a wide body jet, narrow body jet, regional jet or a propeller operated aircraft
- `aircraft_manufacturer` - Manufacturer name for the aircraft that landed at SFO
- `aircraft_model` - Model designation of aircraft by the manufacturer
- `aircraft_version` - Variations of the Aircraft Model, also known as the “dash number”, designated by the manufacturer to segregate unique versions of the same model
- `landing_count` - The number of aircraft landings associated with General and Landings Statistics attribute fields
- `total_landed_weight` - The aircraft landed weight (in pounds) associated with General and Landings Statistics attribute fields

Data source: San Francisco data portal (DataSF) API

    library(sfo)

    data("sfo_stats")

    str(sfo_stats)
    #> 'data.frame':    25765 obs. of  14 variables:
    #>  $ activity_period            : int  202012 202012 202012 202012 202012 202012 202012 202012 202012 202012 ...
    #>  $ operating_airline          : chr  "United Airlines" "United Airlines" "United Airlines" "United Airlines" ...
    #>  $ operating_airline_iata_code: chr  "UA" "UA" "UA" "UA" ...
    #>  $ published_airline          : chr  "United Airlines" "United Airlines" "United Airlines" "United Airlines" ...
    #>  $ published_airline_iata_code: chr  "UA" "UA" "UA" "UA" ...
    #>  $ geo_summary                : chr  "Domestic" "Domestic" "Domestic" "International" ...
    #>  $ geo_region                 : chr  "US" "US" "US" "Asia" ...
    #>  $ landing_aircraft_type      : chr  "Passenger" "Passenger" "Passenger" "Passenger" ...
    #>  $ aircraft_body_type         : chr  "Narrow Body" "Wide Body" "Wide Body" "Wide Body" ...
    #>  $ aircraft_manufacturer      : chr  "Boeing" "Boeing" "Boeing" "Boeing" ...
    #>  $ aircraft_model             : chr  "B753" "B763" "B772" "B772" ...
    #>  $ aircraft_version           : chr  "-" "-" "-" "-" ...
    #>  $ landing_count              : int  78 19 96 1 8 35 44 43 33 1 ...
    #>  $ total_landed_weight        : int  17472000 6080000 43500000 460000 3680000 19390000 24376000 16340000 12540000 380000 ...

    head(sfo_stats)
    #>   activity_period operating_airline operating_airline_iata_code
    #> 1          202012   United Airlines                          UA
    #> 2          202012   United Airlines                          UA
    #> 3          202012   United Airlines                          UA
    #> 4          202012   United Airlines                          UA
    #> 5          202012   United Airlines                          UA
    #> 6          202012   United Airlines                          UA
    #>   published_airline published_airline_iata_code   geo_summary geo_region
    #> 1   United Airlines                          UA      Domestic         US
    #> 2   United Airlines                          UA      Domestic         US
    #> 3   United Airlines                          UA      Domestic         US
    #> 4   United Airlines                          UA International       Asia
    #> 5   United Airlines                          UA International         US
    #> 6   United Airlines                          UA      Domestic         US
    #>   landing_aircraft_type aircraft_body_type aircraft_manufacturer aircraft_model
    #> 1             Passenger        Narrow Body                Boeing           B753
    #> 2             Passenger          Wide Body                Boeing           B763
    #> 3             Passenger          Wide Body                Boeing           B772
    #> 4             Passenger          Wide Body                Boeing           B772
    #> 5             Passenger          Wide Body                Boeing           B772
    #> 6             Passenger          Wide Body                Boeing           B773
    #>   aircraft_version landing_count total_landed_weight
    #> 1                -            78            17472000
    #> 2                -            19             6080000
    #> 3                -            96            43500000
    #> 4                -             1              460000
    #> 5                -             8             3680000
    #> 6                -            35            19390000