# Introduction

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

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

### sfo_passengers

The `sfo_passengers` dataset focuses 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 aircraft operator
- `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` -The flights’ classification by `domestic` for flights that arrived from or departed to a destination within the United States and `international` for destinations outside the United States
- `geo_region` - The flight origin/destination geographic region details
- `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’s terminal designations at SFO where passenger activity took place
- `boarding_area` -The airport’s 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':    50730 obs. of  12 variables:
    #>  $ activity_period            : int  202212 202212 202212 202212 202212 202212 202212 202212 202212 202212 ...
    #>  $ operating_airline          : chr  "EVA Airways" "EVA Airways" "Emirates" "Emirates" ...
    #>  $ operating_airline_iata_code: chr  "BR" "BR" "EK" "EK" ...
    #>  $ published_airline          : chr  "EVA Airways" "EVA Airways" "Emirates" "Emirates" ...
    #>  $ published_airline_iata_code: chr  "BR" "BR" "EK" "EK" ...
    #>  $ geo_summary                : chr  "International" "International" "International" "International" ...
    #>  $ geo_region                 : chr  "Asia" "Asia" "Middle East" "Middle East" ...
    #>  $ activity_type_code         : chr  "Deplaned" "Enplaned" "Deplaned" "Enplaned" ...
    #>  $ price_category_code        : chr  "Other" "Other" "Other" "Other" ...
    #>  $ terminal                   : chr  "International" "International" "International" "International" ...
    #>  $ boarding_area              : chr  "G" "G" "A" "A" ...
    #>  $ passenger_count            : int  12405 15151 13131 14985 2543 2883 1772 1370 2817 1987 ...

    head(sfo_passengers)
    #>   activity_period    operating_airline operating_airline_iata_code
    #> 1          202212          EVA Airways                          BR
    #> 2          202212          EVA Airways                          BR
    #> 3          202212             Emirates                          EK
    #> 4          202212             Emirates                          EK
    #> 5          202212 Flair Airlines, Ltd.                          F8
    #> 6          202212 Flair Airlines, Ltd.                          F8
    #>      published_airline published_airline_iata_code   geo_summary  geo_region
    #> 1          EVA Airways                          BR International        Asia
    #> 2          EVA Airways                          BR International        Asia
    #> 3             Emirates                          EK International Middle East
    #> 4             Emirates                          EK International Middle East
    #> 5 Flair Airlines, Ltd.                          F8 International      Canada
    #> 6 Flair Airlines, Ltd.                          F8 International      Canada
    #>   activity_type_code price_category_code      terminal boarding_area
    #> 1           Deplaned               Other International             G
    #> 2           Enplaned               Other International             G
    #> 3           Deplaned               Other International             A
    #> 4           Enplaned               Other International             A
    #> 5           Deplaned            Low Fare International             A
    #> 6           Enplaned            Low Fare International             A
    #>   passenger_count
    #> 1           12405
    #> 2           15151
    #> 3           13131
    #> 4           14985
    #> 5            2543
    #> 6            2883

### sfo_stats

The `sfo_stats` dataset focuses 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 aircraft operator
- `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` -The flights’ classification by `domestic` for flights that arrived from or departed to a destination within the United States and `international` for destinations outside the United States
- `geo_region` - The flight origin/destination geographic region details
- `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':    57381 obs. of  14 variables:
    #>  $ activity_period            : int  202212 202212 202212 202212 202212 202212 202212 202212 202212 202212 ...
    #>  $ operating_airline          : chr  "Air Canada" "Delta Air Lines" "Delta Air Lines" "WestJet Airlines" ...
    #>  $ operating_airline_iata_code: chr  "AC" "DL" "DL" "WS" ...
    #>  $ published_airline          : chr  "Air Canada" "Delta Air Lines" "Delta Air Lines" "WestJet Airlines" ...
    #>  $ published_airline_iata_code: chr  "AC" "DL" "DL" "WS" ...
    #>  $ geo_summary                : chr  "International" "Domestic" "Domestic" "International" ...
    #>  $ geo_region                 : chr  "Canada" "US" "US" "Canada" ...
    #>  $ landing_aircraft_type      : chr  "Passenger" "Passenger" "Passenger" "Passenger" ...
    #>  $ aircraft_body_type         : chr  "Wide Body" "Narrow Body" "Narrow Body" "Narrow Body" ...
    #>  $ aircraft_manufacturer      : chr  "Boeing" "Airbus" "Airbus" "Boeing" ...
    #>  $ aircraft_model             : chr  "B773" "A319" "A320" "B38M" ...
    #>  $ aircraft_version           : chr  "-" "-" "-" "-" ...
    #>  $ landing_count              : int  1 163 43 5 5 3 22 33 19 269 ...
    #>  $ total_landed_weight        : int  554000 22459444 6114514 764000 646000 438900 8360000 5660127 2779700 42313700 ...

    head(sfo_stats)
    #>   activity_period operating_airline operating_airline_iata_code
    #> 1          202212        Air Canada                          AC
    #> 2          202212   Delta Air Lines                          DL
    #> 3          202212   Delta Air Lines                          DL
    #> 4          202212  WestJet Airlines                          WS
    #> 5          202212  WestJet Airlines                          WS
    #> 6          202212  WestJet Airlines                          WS
    #>   published_airline published_airline_iata_code   geo_summary geo_region
    #> 1        Air Canada                          AC International     Canada
    #> 2   Delta Air Lines                          DL      Domestic         US
    #> 3   Delta Air Lines                          DL      Domestic         US
    #> 4  WestJet Airlines                          WS International     Canada
    #> 5  WestJet Airlines                          WS International     Canada
    #> 6  WestJet Airlines                          WS International     Canada
    #>   landing_aircraft_type aircraft_body_type aircraft_manufacturer aircraft_model
    #> 1             Passenger          Wide Body                Boeing           B773
    #> 2             Passenger        Narrow Body                Airbus           A319
    #> 3             Passenger        Narrow Body                Airbus           A320
    #> 4             Passenger        Narrow Body                Boeing           B38M
    #> 5             Passenger        Narrow Body                Boeing           B737
    #> 6             Passenger        Narrow Body                Boeing           B738
    #>   aircraft_version landing_count total_landed_weight
    #> 1                -             1              554000
    #> 2                -           163            22459444
    #> 3                -            43             6114514
    #> 4                -             5              764000
    #> 5                -             5              646000
    #> 6                -             3              438900