-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
118 lines (87 loc) · 5.06 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(tibble)
options(tibble.max_extra_cols = 20,
tibble.bold = TRUE,
tibble.print_max = 5)
```
# ffopportunity <a href='https://ffopportunity.ffverse.com'><img src='man/figures/logo.svg' align="right" width="25%" min-width="120px"/></a>
*Models and Data for Expected Fantasy Points*
<!-- badges: start -->
[![CRAN status](https://img.shields.io/cran/v/ffopportunity?style=flat-square&logo=R&label=CRAN)](https://CRAN.R-project.org/package=ffopportunity)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg?style=flat-square)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Dev
status](https://img.shields.io/github/r-package/v/ffverse/ffopportunity/main?label=dev&style=flat-square&logo=github)](https://ffopportunity.ffverse.com/)
[![Codecov test coverage](https://img.shields.io/codecov/c/github/ffverse/ffopportunity?label=codecov&style=flat-square&logo=codecov)](https://app.codecov.io/gh/ffverse/ffopportunity?branch=main)
[![nflverse discord](https://img.shields.io/discord/789805604076126219?color=7289da&label=nflverse%20discord&logo=discord&logoColor=fff&style=flat-square)](https://discord.com/invite/5Er2FBnnQa)
<!-- badges: end -->
ffopportunity builds a dataframe of Expected Fantasy Points by preprocessing and applying an xgboost model to nflverse play-by-play data. It also includes utilities to download precomputed data from automated GitHub releases.
## About
Expected Fantasy Points are a measure of player opportunities in fantasy football - essentially aiming to quantify how many points the average player would score given a specific situation and opportunity. It uses xgboost and tidymodels trained on public nflverse data from 2006-2020 to do this.
For more on the modeling details, see the articles posted to this website: <https://ffopportunity.ffverse.com/articles/>
## Installation
<!--Install the stable version from CRAN with:
```{r eval = FALSE}
install.packages("ffopportunity")
```
-->
Install the development version from GitHub with:
```{r eval = FALSE}
install.packages("ffopportunity", repos = c("https://ffverse.r-universe.dev", getOption("repos")))
# or use remotes/devtools
# install.packages("remotes")
remotes::install_github("ffverse/ffopportunity")
```
## Usage
The two main functions of {ffopportunity} are `ep_load()` and `ep_build()`.
You can download the latest version of the EP data with `ep_load()` as follows:
```{r}
library(ffopportunity)
ep_load(season = 2020:2021, type = "weekly")
```
You can also build EP from base nflverse data with `ep_build()` as follows:
```{r eval = FALSE}
ep_build(season = 2021, version = "latest")
```
```
#> -- Starting ep build for 2021 season(s)! 2022-01-11 07:58:44 -------------------
#> > Loading pbp 2022-01-11 07:58:44
#> > Preprocessing pbp 2022-01-11 07:58:46
#> > Generating predictions 2022-01-11 07:58:54
#> > Summarizing data 2022-01-11 07:59:33
#> -- Finished building ep for 2021 season(s)! 2022-01-11 07:59:33 ----------------
#> > <ffopportunity predictions>
#> > Generated 2022-01-11 07:59:33 with model version latest
#> List of 5
#> $ ep_weekly : tibble [5,756 x 159] (S3: tbl_df/tbl/data.frame)
#> $ ep_pbp_pass: tibble [18,747 x 57] (S3: tbl_df/tbl/data.table/data.frame)
#> $ ep_pbp_rush: tibble [14,038 x 47] (S3: tbl_df/tbl/data.table/data.frame)
#> $ ep_version : chr "latest"
#> $ timestamp : POSIXct[1:1], format: "2022-01-11 07:59:33"
```
## Data
ffopportunity data is automated with GitHub Actions and can be manually downloaded in RDS, parquet, and csv formats from the [releases page](https://github.com/ffverse/ffopportunity/releases).
## Getting help
The best places to get help on this package are:
- the [nflverse discord](https://discord.com/invite/5Er2FBnnQa) (for both this package as well as anything R/NFL related)
- opening [an issue](https://github.com/ffverse/ffopportunity/issues/new/choose)
## Contributing
Many hands make light work! Here are some ways you can contribute to
this project:
- You can [open an issue](https://github.com/ffverse/ffopportunity/issues/new/choose) if you’d like to request specific data or report a bug/error.
- If you’d like to contribute code, please check out [the contribution guidelines](https://ffopportunity.ffverse.com/CONTRIBUTING.html).
## Terms of Use
The R code for this package is released as open source under the [GPL v3 License](https://ffopportunity.ffverse.com/LICENSE.html). The models and expected
points data included within this package's are licensed under [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/)
## Code of Conduct
Please note that the ffopportunity project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.