fflr

Get ESPN fantasy football data in R

https://github.com/k5cents/fflr

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.0%) to scientific vocabulary

Keywords

espn fantasy-football
Last synced: 6 months ago · JSON representation

Repository

Get ESPN fantasy football data in R

Basic Info
Statistics
  • Stars: 24
  • Watchers: 2
  • Forks: 8
  • Open Issues: 7
  • Releases: 10
Topics
espn fantasy-football
Created over 6 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Support

README.Rmd

---
output: github_document
editor_options: 
  chunk_output_type: console
---



```{r include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  error = FALSE,
  comment = "#>",
  fig.path = "man/figures/README-",
  fig.height = 4,
  fig.width = 9,
  out.width = "100%",
  dpi = 300
)
if (!interactive()) {
  options(width = 99)
}
```

# fflr 


[![Lifecycle: experimental][life_badge]][life_link]
[![CRAN status][cran_badge]][cran_link]
![Downloads][dl_badge]
[![Codecov test coverage][cov_badge]][cov_link]
[![R build status][ga_badge]][ga_link]


The fflr package is used to query the [ESPN Fantasy Football API][api]. Get data
on fantasy football league members, teams, and individual athletes.

This package has been tested with a narrow subset of possible league settings.
If a function doesn't work as intended, please file an [issue on GitHub][iss].

## Installation

> [!IMPORTANT]  
> As of 2024-05-17, fflr was removed from [CRAN][cran] for failure to comply
with the policy on internet resources. This issue arose when ESPN changed their
API format and adjusted endpoints to account for the end of the 2023 NFL season.
I hope to work with CRAN to get the package published again before the 2024
season, but it may not be possible.

> [!IMPORTANT]  
> As of 2025-08-01, ESPN has changed their API to restrict access to historical
data previously obtained via the `leagueHistory = TRUE` argument. Now you must
sign into ESPN via your web browser and copy the "espn_s2" cookie using the
inspect element tools. That cookie can then be passed to `ffl_api()` by
providing the `cookie` argument to any function with the `...` argument.

The most recent development version can always be installed from [GitHub][gh]:

```{r remote, eval=FALSE}
# install.packages("remotes")
remotes::install_github("k5cents/fflr")
```

## Usage

```{r library-fflr}
library(fflr)
packageVersion("fflr")
```

Data is only available for public leagues. See [this help page][help] on how to
make a private league public

Functions require a unique `leagueId`, which can be found in any ESPN page URL.

https://fantasy.espn.com/football/league?leagueId=42654852
Use `ffl_id()` to set a default `fflr.leagueId` option. Your `.Rprofile` file can [set this option on startup][rprof]. ```{r rm-opt, echo=FALSE} options(fflr.leagueId = NULL) ``` ```{r ffl-id, message=TRUE} ffl_id(leagueId = "42654852") ``` The `leagueId` argument defaults to `ffl_id()` and can be omitted once set. ```{r league-teams} league_info() league_teams() ``` The `scoringPeriodId` argument can be used to get data from past weeks. ```{r team-roster} all_rost <- team_roster(scoringPeriodId = 1) all_rost$CHI[, 5:13][-7] ``` There are included objects for NFL teams and players. ```{r nfl-players} nfl_teams ``` > [!NOTE] > The fflr project is released with a [Contributor Code of Conduct][coc]. By contributing, you agree to abide by its terms. [life_badge]: https://img.shields.io/badge/lifecycle-stable-brightgreen.svg [life_link]: https://lifecycle.r-lib.org/articles/stages.html#stable [cran_badge]: https://www.r-pkg.org/badges/version/fflr [cran_link]: https://CRAN.R-project.org/package=fflr [ga_badge]: https://github.com/k5cents/fflr/workflows/R-CMD-check/badge.svg [ga_link]: https://github.com/k5cents/fflr/actions [cov_badge]: https://codecov.io/gh/k5cents/fflr/graph/badge.svg?token=CMz6DIxJdH [cov_link]: https://app.codecov.io/gh/k5cents/fflr?branch=master [dl_badge]: https://cranlogs.r-pkg.org/badges/grand-total/fflr [api]: https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/ [iss]: https://github.com/k5cents/fflr/issues [cran]: https://cran.r-project.org/package=fflr [gh]: https://github.com/k5cents/fflr [coc]: https://k5cents.github.io/fflr/CODE_OF_CONDUCT.html [help]: https://web.archive.org/web/20211105212446/https://support.espn.com/hc/en-us/articles/360000064451-Making-a-Private-League-Viewable-to-the-Public [rprof]: https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html

Owner

  • Name: Kiernan Nicholls
  • Login: k5cents
  • Kind: user
  • Location: Washington, DC

Political data analyst

GitHub Events

Total
  • Issues event: 2
  • Watch event: 4
  • Issue comment event: 1
  • Push event: 3
  • Fork event: 2
Last Year
  • Issues event: 2
  • Watch event: 4
  • Issue comment event: 1
  • Push event: 3
  • Fork event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 0
  • Average time to close issues: 7 months
  • Average time to close pull requests: N/A
  • Total issue authors: 3
  • Total pull request authors: 0
  • Average comments per issue: 0.67
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • KevinLeone (1)
  • jcsagerer (1)
  • lumenswashere (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 456 last-month
  • Total docker downloads: 41,971
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 18
  • Total maintainers: 1
cran.r-project.org: fflr

Retrieve ESPN Fantasy Football Data

  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 456 Last month
  • Docker Downloads: 41,971
Rankings
Docker downloads count: 0.6%
Average: 21.7%
Dependent repos count: 24.0%
Dependent packages count: 28.8%
Downloads: 33.4%
Maintainers (1)
Last synced: 7 months ago