Description Usage Format Source Examples
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/.
1 |
A data frame with 56 rows representing airlines and 9 variables:
airline
indicates that regional subsidiaries are included
available seat kilometers flown every week
Total number of incidents, 1985-1999
Total number of fatal accidents, 1985-1999
Total number of fatalities, 1985-1999
Total number of incidents, 2000-2014
Total number of fatal accidents, 2000-2014
Total number of fatalities, 2000-2014
Aviation Safety Network https://aviation-safety.net.
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)
)
|
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: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.