Learn R Programming

fivethirtyeight (version 0.5.0)

house_district_forecast: 2018 House Forecast

Description

The raw data behind the story 'Forecasting the race for the House' https://projects.fivethirtyeight.com/2018-midterm-election-forecast/house/

Usage

house_district_forecast

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 see Examples below. The preview is a data frame with 10 rows representing district-level results of the classic, lite, and deluxe house forecasts since 2018/08/01 and 11 variables.

forecastdate

date of the forecast

state

state of the forecast

district

district of the forecast

candidate

name of the candidate

party

party of the candidate

incumbent

whether the candidate is incumbent

model

the model of the forecast

win_probability

the probability of the corresponding party winning

voteshare

the voteshare of the corresponding party

p10_voteshare

the top 10 percentile of the voteshare

p90_voteshare

the top 00 percentile of the voteshare

See Also

house_national_forecast

Examples

Run this code
# NOT RUN {
if(FALSE){

# To obtain the entire dataset, run the following code:
library(readr)
library(dplyr)
library(janitor)

house_district_forecast <-
  "https://projects.fivethirtyeight.com/congress-model-2018/house_district_forecast.csv" %>%
  read_csv() %>%
  clean_names() %>%
  mutate(
    state = as.factor(state),
    district = as.factor(district),
    party = as.factor(party),
    model = as.factor(model)
  ) %>%
  select(-special)

}
# }

Run the code above in your browser using DataLab