Nothing
## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup, message = F, warning = F------------------------------------------
library(NFLSimulatoR)
library(knitr)
set.seed(584)
## ---- message = FALSE, warning = FALSE----------------------------------------
pbp_data <- nflfastR::load_pbp(2019)
pbp_data <- NFLSimulatoR::prep_pbp_data(pbp_data)
## ---- eval = FALSE------------------------------------------------------------
# pbp_data <- nflfastR::load_pbp(2019)
# pbp_data <- NFLSimulatoR::prep_pbp_data(pbp_data)
## -----------------------------------------------------------------------------
play <- NFLSimulatoR::sample_play(
what_down = 3,
yards_to_go = 2,
yards_from_own_goal = 45,
play_by_play_data = pbp_data,
strategy = "normal"
)
knitr::kable(play[, c("desc",
"down",
"ydstogo",
"yardline_100",
"play_type",
"yards_gained")])
## -----------------------------------------------------------------------------
play <- NFLSimulatoR::sample_play(
what_down = 3,
yards_to_go = 2,
yards_from_own_goal = 45,
play_by_play_data = pbp_data,
strategy = "passes_rushes",
prop_passes = 0.5
)
knitr::kable(play[, c("desc",
"down",
"ydstogo",
"yardline_100",
"play_type",
"yards_gained")])
## -----------------------------------------------------------------------------
play <- sample_play(
what_down = 4,
yards_to_go = 2,
yards_from_own_goal = 45,
play_by_play_data = pbp_data,
strategy = "fourth_downs",
fourth_down_strategy = "yds_less_than",
yards_less_than = 5
)
knitr::kable(play[, c("desc",
"down",
"ydstogo",
"yardline_100",
"play_type",
"yards_gained")])
## -----------------------------------------------------------------------------
drives <- NFLSimulatoR::sample_drives(
n_sims = 10,
from_yard_line = 25,
play_by_play_data = pbp_data,
strategy = "fourth_downs",
fourth_down_strategy = "empirical",
single_drive = T,
progress = F #shows progress bar for simulations
)
drives$points
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.