airline_safety: Should Travelers Avoid Flying Airlines That Have Had Crashes...

Description Usage Format Source Examples

Description

The raw data behind the story "Should Travelers Avoid Flying Airlines That Have Had Crashes in the Past?" https://fivethirtyeight.com/features/should-travelers-avoid-flying-airlines-that-have-had-crashes-in-the-past/.

Usage

1

Format

A data frame with 56 rows representing airlines and 9 variables:

airline

airline

incl_reg_subsidiaries

indicates that regional subsidiaries are included

avail_seat_km_per_week

available seat kilometers flown every week

incidents_85_99

Total number of incidents, 1985-1999

fatal_accidents_85_99

Total number of fatal accidents, 1985-1999

fatalities_85_99

Total number of fatalities, 1985-1999

incidents_00_14

Total number of incidents, 2000-2014

fatal_accidents_00_14

Total number of fatal accidents, 2000-2014

fatalities_00_14

Total number of fatalities, 2000-2014

Source

Aviation Safety Network https://aviation-safety.net.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# To convert data frame to tidy data (long) format, run:
library(dplyr)
library(tidyr)
library(stringr)
airline_safety_tidy <- airline_safety %>%
  pivot_longer(-c(airline, incl_reg_subsidiaries, avail_seat_km_per_week), 
    names_to = "type", values_to = "count") %>%
  mutate(
    period = str_sub(type, start=-5),
    period = str_replace_all(period, "_", "-"),
    type = str_sub(type, end=-7)
  )

Example output

Some larger datasets need to be installed separately, like senators and
house_district_forecast. To install these, we recommend you install the
fivethirtyeightdata package by running:
install.packages('fivethirtyeightdata', repos =
'https://fivethirtyeightdata.github.io/drat/', type = 'source')

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union

fivethirtyeight documentation built on Oct. 7, 2021, 5:09 p.m.