2018 Update of ffanalytics R Package
This article is originally published at https://fantasyfootballanalytics.net
As part of our effort to provide users ways to replicate our analyses and improve their performance in fantasy football, we are continuously looking at ways we can improve our tools. Since the
ffanalytics package was introduced back in 2016, we have had a tremendous response and feedback on the package and have worked through some of the kinks and are now introducing a new version of the
ffanalytics package that should be more robust and provide more consistent results.
One of the major concerns with data scrapes is that websites change and so does the way data are rendered on individual pages. Where the old version of the
ffanalytics package was highly dependent on how columns were ordered on the different sites, the new version of the package does not depend on column order. Instead the package looks for specific components of the page and, based on predefined mapping, can determine which columns are which.
The other major concern is that different sites lists the same player with a slightly different name (i.e. Rob Kelly or Robert Kelly) or at different positions, so matching up the data can be tricky. The new version of the package maps player IDs from the different sites back to the player ID used by MyFantasyLeague.com, so it now doesn’t matter what name or position a specific player is listed as on a specific site because the data for a specific player will match up correctly.
Finally, the new version of the package relies heavily on the vocabulary and terminology used in the
tidyverse package. We highly recommend familiarizing yourself with that package.
It is our intent that the new version of the package will provide more consistent scrapes for users.
The player information used in the package is based on player information from MyFantasyLeague.com (MFL). When the package is loaded, it pulls the most recent player data from MFL into the
player_table object. When the scrape runs, it determines the player ID for the player on the site that is being scraped and maps that ID back to the MFL player ID. The scraped data contains an
id column which holds the player ID for MFL, and a
src_id column that has the ID for the site. However, when aggregating the stats and generating the projections the player ID used is the MFL player ID.
The customization of calculations is done as input to the
projections_table() function. You can specify your own scoring rules, analyst weights, tier thresholds and VOR baselines to be used in the calculations. See
?projections_table for specifics, and check out the
scoring_settings vignette on how to customize scoring rules
In addition to the documentation that is included within the package and can be explored directly in R/RStudio, we have also made that documentation available as a
pkgdown site here.
Installation and getting started
We have updated the instructions on installing and getting the package here so you can check that page out, and feel free to leave comments with feedback and suggestions.
Please visit source website for post related comments.