Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the documentation in #47 #53

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/airlines.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' Look up airline names from their carrier codes.
#'
#' @source <https://www.transtats.bts.gov/DL_SelectFields.asp?Table_ID=236>
#' @source <https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FGJ&QO_fu146_anzr=b0-gvzr>
#' @format Data frame with columns
#' \describe{
#' \item{carrier}{Two letter abbreviation.}
Expand Down
2 changes: 1 addition & 1 deletion R/flights.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' 2013.
#'
#' @source RITA, Bureau of transportation statistics,
#' <https://www.transtats.bts.gov/DL_SelectFields.asp?Table_ID=236>
#' <https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FGJ&QO_fu146_anzr=b0-gvzr>
#' @format Data frame with columns
#' \describe{
#' \item{year, month, day}{Date of departure.}
Expand Down
2 changes: 1 addition & 1 deletion data-raw/airlines.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(dplyr)
library(readr)

raw <- read_csv("https://www.transtats.bts.gov/Download_Lookup.asp?Lookup=L_UNIQUE_CARRIERS")
raw <- read_csv("https://www.transtats.bts.gov/Download_Lookup.asp?Y11x72=Y_haVdhR_PNeeVRef")

load("data/flights.rda")

Expand Down
2 changes: 1 addition & 1 deletion data-raw/airlines.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AA,American Airlines Inc.
AS,Alaska Airlines Inc.
B6,JetBlue Airways
DL,Delta Air Lines Inc.
EV,ExpressJet Airlines Inc.
EV,ExpressJet Airlines LLC d/b/a aha!
F9,Frontier Airlines Inc.
FL,AirTran Airways Corporation
HA,Hawaiian Airlines Inc.
Expand Down
2 changes: 1 addition & 1 deletion data-raw/airports.csv
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ faa,name,lat,lon,alt,tz,dst,tzone
19A,Jackson County Airport,34.1758638,-83.5615972,951,-5,U,America/New_York
1A3,Martin Campbell Field Airport,35.0158056,-84.3468333,1789,-5,A,America/New_York
1B9,Mansfield Municipal,42.0001331,-71.1967714,122,-5,A,America/New_York
1C9,Frazier Lake Airpark,54.013333333333335,-124.76833333333333,152,-8,A,America/Vancouver
1C9,Frazier Lake Airpark,54.013333333333335,-124.76833333333332,152,-8,A,America/Vancouver
1CS,Clow International Airport,41.6959744,-88.1292306,670,-6,U,America/Chicago
1G3,Kent State Airport,41.1513889,-81.4151111,1134,-5,A,America/New_York
1G4,Grand Canyon West Airport,35.899904,-113.815674,4813,-7,A,America/Phoenix
Expand Down
2,931 changes: 1,470 additions & 1,461 deletions data-raw/airports.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions data-raw/flights.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ library(readr)

flight_url <- function(year = 2013, month) {
base_url <- "https://www.transtats.bts.gov/PREZIP/"
sprintf(paste0(base_url, "On_Time_On_Time_Performance_%d_%d.zip"), year, month)
sprintf(paste0(base_url, "On_Time_Reporting_Carrier_On_Time_Performance_1987_present_%d_%d.zip"), year, month)
}

download_month <- function(year = 2013, month) {
Expand Down Expand Up @@ -35,16 +35,16 @@ get_nyc <- function(path) {
ArrTime = col_integer(),
CRSDepTime = col_integer(),
CRSArrTime = col_integer(),
Carrier = col_character(),
UniqueCarrier = col_character()
Reporting_Airline = col_character()#,
# UniqueCarrier = col_character()
)
read_csv(path, col_types = col_types) %>%
select(
year = Year, month = Month, day = DayofMonth,
dep_time = DepTime, sched_dep_time = CRSDepTime, dep_delay = DepDelay,
arr_time = ArrTime, sched_arr_time = CRSArrTime, arr_delay = ArrDelay,
carrier = Carrier, flight = FlightNum, tailnum = TailNum,
origin = Origin, dest = Dest,
carrier = Reporting_Airline, flight = Flight_Number_Reporting_Airline,
tailnum = Tail_Number, origin = Origin, dest = Dest,
air_time = AirTime, distance = Distance
) %>%
filter(origin %in% c("JFK", "LGA", "EWR")) %>%
Expand Down
16 changes: 9 additions & 7 deletions data-raw/planes.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ library(readr)

# Update URL from
# http://www.faa.gov/licenses_certificates/aircraft_certification/aircraft_registry/releasable_aircraft_download/
src <- "http://registry.faa.gov/database/AR062014.zip"
src <- "https://registry.faa.gov/database/yearly/ReleasableAircraft.2013.zip"
lcl <- "data-raw/planes"

if (!file.exists(lcl)) {
Expand All @@ -15,20 +15,22 @@ if (!file.exists(lcl)) {
}

master <- read.csv("data-raw/planes/MASTER.txt", stringsAsFactors = FALSE, strip.white = TRUE)
names(master) <- tolower(names(master))

keep <- master %>%
tbl_df() %>%
select(nnum = n.number, code = mfr.mdl.code, year = year.mfr)
as_tibble() %>%
select("nnum" = 1, "code" = 3, "year" = 5)

ref <- read.csv("data-raw/planes//ACFTREF.txt",
ref <- read.csv("data-raw/planes/AcftRef.txt",
stringsAsFactors = FALSE,
strip.white = TRUE
)
names(ref) <- tolower(names(ref))
names(ref) <-
c("mfr", "model", "type.acft", "type.eng", "ac.category",
"amat.tc.built", "no.eng", "no.seats", "ac.weight", "speed", "code",
"kit.code", "extra")

ref <- ref %>%
tbl_df() %>%
as_tibble() %>%
select(code, mfr, model, type.acft, type.eng, no.eng, no.seats, speed)

# Combine together
Expand Down
84 changes: 61 additions & 23 deletions data-raw/planes.csv

Large diffs are not rendered by default.

4,298 changes: 2,172 additions & 2,126 deletions data-raw/weather.csv

Large diffs are not rendered by default.

Binary file modified data/airlines.rda
Binary file not shown.
Binary file modified data/airports.rda
Binary file not shown.
Binary file modified data/flights.rda
Binary file not shown.
Binary file modified data/planes.rda
Binary file not shown.
Binary file modified data/weather.rda
Binary file not shown.