https://github.com/ffverse/ffsimulator
Simulate Fantasy Football Seasons
https://github.com/ffverse/ffsimulator
fantasy-football r-package simulation
Last synced: 3 months ago
JSON representation
Simulate Fantasy Football Seasons
- Host: GitHub
- URL: https://github.com/ffverse/ffsimulator
- Owner: ffverse
- License: other
- Created: 2021-06-06T01:59:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-03T14:22:03.000Z (over 1 year ago)
- Last Synced: 2025-10-22T04:58:58.906Z (3 months ago)
- Topics: fantasy-football, r-package, simulation
- Language: R
- Homepage: https://ffsimulator.ffverse.com
- Size: 54.2 MB
- Stars: 21
- Watchers: 2
- Forks: 5
- Open Issues: 13
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
fig.width = 8,
fig.height = 4,
eval = FALSE
)
```
[](https://CRAN.R-project.org/package=ffsimulator)
[](https://ffsimulator.ffverse.com/)
[](https://lifecycle.r-lib.org/articles/stages.html)
[](https://github.com/ffverse/ffsimulator/actions)
[](https://app.codecov.io/gh/ffverse/ffsimulator)
[](https://discord.com/invite/5Er2FBnnQa)
The `{ffsimulator}` package uses bootstrap resampling to run fantasy football season simulations supported by historical rankings and nflfastR data, calculating optimal lineups, and returning aggregated results. This can quickly run your league through hundreds of seasons and builds out the data to help you study:
- expected season finishes and range of outcomes
- player contributions to season wins
- roster constructions
- effects of (potential) trades
- and more!
This package is part of the [ffverse](https://www.ffverse.com) family of R packages for fantasy football analysis.
## Installation
Install the stable version of this package from CRAN:
```{r}
install.packages("ffsimulator") # CRAN
```
Install the development version from either [r-universe](https://ffverse.r-universe.dev) or GitHub:
```{r}
install.packages("ffsimulator", repos = "https://ffverse.r-universe.dev")
# pak is recommended, see https://github.com/r-lib/pak
pak::pak("ffverse/ffsimulator")
# can also use remotes
remotes::install_github("ffverse/ffsimulator")
```
The development version has a [separate documentation site here](https://ffsimulator.ffverse.com/dev/).
## Usage
A season simulation can be run as follows:
```{r eval = FALSE}
library(ffsimulator)
library(ggplot2)
library(ggridges)
mfl_conn <- mfl_connect(season = 2021, league_id = 22627)
## OTHER PLATFORM CONNECTIONS MAY BE USED, FOR EXAMPLE:
# sleeper_conn <- sleeper_connect(season = 2021, league_id = "652582284720971776")
# flea_conn <- fleaflicker_connect(season = 2021, league_id = 312861)
# espn_conn <- espn_connect(season = 2021, league_id = 899513)
mfl_sim <- ff_simulate(conn = mfl_conn, n_seasons = 100)
plot(mfl_sim)
```

Please also see the
- [basic usage](https://ffsimulator.ffverse.com/articles/basic.html) and
- [custom simulations](https://ffsimulator.ffverse.com/articles/custom.html)
vignettes for more detailed introductions.
## 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/ffsimulator/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/ffsimulator/issues/new/choose) if you'd like to request specific data or report a bug/error.
- You can [sponsor this project with donations](https://github.com/sponsors/tanho63)!
- If you'd like to contribute code, please check out [the contribution guidelines](https://ffsimulator.ffverse.com/CONTRIBUTING.html).
## Terms of Use
The R code for this package is released as open source under the [MIT License](https://ffsimulator.ffverse.com/LICENSE.html).
Fantasy football and NFL data accessed by this package belong to their respective owners, and are governed by their terms of use.
