

To do so we use the filter function and a series of logical operators. Logical operators: Filtering for certain observations (e.g. flights from a particular airport) is often of interest in data frames where we might want to examine observations with certain characteristics separately from the rest of the data.
#AIRLINE ONTIME STATS CODE#
(Google can help you with what code stands for which airport.) origin, dest: Airport codes for origin and destination.carrier: Two letter carrier abbreviation.Negative times represent early departures/arrivals. dep_delay, arr_delay: Departure and arrival delays, in minutes.

dep_time, arr_time: Departure and arrival times, local timezone.This information can also be found in the help file for the data frame which can be accessed by typing ?nycflights in the console. The codebook (description of the variables) is included below. This returns the names of the variables in this data frame. # "arr_time" "arr_delay" "carrier" "tailnum" "flight" To view the names of the variables, type the command names(nycflights) # "year" "month" "day" "dep_time" "dep_delay" R calls this data format a data frame, which is a term that will be used throughout the labs. The data frame containing 32735 flights that shows up in your workspace is a data matrix, with each row representing an observation and each column representing a variable. Type the following in your console to load the data: data(nycflights) We begin by loading the nycflights data frame. As its name implies, BTS collects and makes available transportation data, such as the flights data we will be working with in this lab.

The Bureau of Transportation Statistics (BTS) is a statistical agency that is a part of the Research and Innovative Technology Administration (RITA).
