fivethirtyeight
An R package that provides access to the code and data sets published by FiveThirtyEight https://github.com/fivethirtyeight/data. Note that while we received guidance from editors at 538, this package is not officially published by 538.
Installation & Usage
Get the released version from CRAN:
install.packages("fivethirtyeight")
Or the development version from GitHub:
# If you haven't installed devtools yet, do so:
# install.packages("devtools")
devtools::install_github("rudeboybert/fivethirtyeight")
Example usage:
library(fivethirtyeight)
data(package = "fivethirtyeight")
# Bechdel data set:
data(bechdel)
head(bechdel)
?bechdel
# If using RStudio:
View(bechdel)
More Information
See the package vignette for:
- Our motivation for creating this package.
- Guidelines we followed preparing the data sets and links to the code.
- A more detailed outline of all data sets.
vignette("fivethirtyeight", package = "fivethirtyeight")
Collaborate
Code
In many instances, the data sets had the R code used in the analysis. We would love to
- Convert the code to use
tidyverse
package tools - Present the code in R Markdown format
For example, we did this using the R code for the article The Dollar-And-Cents Case Against Hollywood’s Exclusion of Women here:
vignette("bechdel", package = "fivethirtyeight")
Contributing to the Package
If you want to contribute to the package:
- We followed the principles in Hadley Wickham's R packages book
- Preliminary instructions for automating R package documentation and collecting data about the data sets is available here.