fivethirtyeight (version 0.4.0)

mlb_elo: MLB Elo

Description

The raw data behind the stories: "The Complete History Of MLB" https://projects.fivethirtyeight.com/complete-history-of-mlb/ and "MLB Predictions" https://projects.fivethirtyeight.com/2017-mlb-predictions/.

Usage

mlb_elo

Arguments

Format

Because of R package size restrictions, only a preview of the first 10 rows of this dataset is included; to obtain the entire dataset (1871 to 2017 games) see Examples below. A data frame with 10 rows representing Elo ratings and 26 variables:

date

The date of the game.

season

The season within which the game was played.

neutral

No description provided.

playoff

No description provided.

team1

One team that participated in the game.

team2

The other team that participated in the match.

elo1_pre

The Elo rating for team1 prior to the game.

elo2_pre

The Elo rating for team2 prior to the game.

elo_prob1

No description provided.

elo_prob2

No description provided.

elo1_post

The Elo rating for team1 after the game.

elo2_post

The Elo rating for team2 after the game.

rating1_pre

No description provided.

rating2_pre

No description provided.

pitcher1

An identifier of the pitcher

pitcher2

No description provided.

pitcher1_rating

No description provided.

pitcher2_rating

No description provided.

pitcher1_adj

No description provided.

pitcher2_adj

No description provided.

rating_prob1

No description provided.

rating_prob2

No description provided.

rating1_post

No description provided.

rating2_post

No description provided.

score1

The number of runs scored by team1.

score2

The number of runs scored by team2.

Examples

Run this code
# NOT RUN {
# To obtain the entire dataset, run the code inside the following if statement:
if(FALSE){
  library(tidyverse)
  mlb_elo <- read_csv("https://projects.fivethirtyeight.com/mlb-api/mlb_elo.csv") %>%
    mutate(
      playoff = as.factor(playoff),
      playoff = ifelse(playoff == "<NA>", NA, playoff),
      neutral = as.logical(neutral)
    )
}
# }

Run the code above in your browser using DataCamp Workspace