ffhistorian is an R package that retrieves and visualizes fantasy
football league history data. Built on top of the excellent
ffscrapr package, it provides
tools to analyze league performance across seasons, track user
statistics, and create insightful visualizations of your fantasy
football league’s history.
You can install the development version of ffhistorian from GitHub:
# pak is recommended, see https://github.com/r-lib/pak
pak::pak("ffverse/ffhistorian")
# can also use remotes
remotes::install_github("ffverse/ffhistorian")The main workflow involves three steps:
- Connect to your league using
ffscrapr - Pull league history with
ff_history() - Analyze and visualize the results
library(ffhistorian)
conn <- ffscrapr::sleeper_connect(2025, "1200503479357952000")
history <- ff_history(conn)ffhistorian supports all platforms available through ffscrapr:
- Sleeper
- ESPN (requires authentication)
- MFL (MyFantasyLeague)
- Fleaflicker
ESPN leagues require authentication via espn_s2 and swid cookies:
# Store credentials as environment variables (recommended)
conn <- ffscrapr::espn_connect(
season = 2025,
league_id = "your_league_id",
espn_s2 = Sys.getenv("ESPN_S2"),
swid = Sys.getenv("SWID")
)
history <- ff_history(conn)
summary(history)conn <- ffscrapr::mfl_connect(2025, league_id = "12345")
history <- ff_history(conn)
summary(history)The best places to get help on this package are:
- the nflverse discord (for both this package as well as anything R/NFL related)
- opening an issue
The R code for this package is released as open source under the MIT license.
The APIs and data accessed by this package belong to their respective owners, and are governed by their terms of use.
