Learn R Programming

ffscrapr (version 1.2.1)

ff_playerscores: Get Player Scoring History

Description

This function returns a tidy dataframe of player scores based on league rules.

Unfortunately, Sleeper has deprecated their player stats endpoint from their supported/open API. Adding some nflfastr-based ideas to the pipeline for future iterations.

Usage

ff_playerscores(conn, ...)

# S3 method for flea_conn ff_playerscores(conn, page_limit = NULL, ...)

# S3 method for mfl_conn ff_playerscores(conn, season, week, ...)

# S3 method for sleeper_conn ff_playerscores(conn, ...)

Arguments

conn

the list object created by ff_connect()

...

other arguments (currently unused)

page_limit

A numeric describing the number of pages to return - default NULL returns all available

season

the season of interest - generally only the most recent 2-3 seasons are available

week

a numeric or one of YTD (year-to-date) or AVG (average to date)

Value

A tibble of historical player scoring

Methods (by class)

  • flea_conn: Fleaflicker: returns the season, season average, and standard deviation

  • mfl_conn: MFL: returns the player fantasy scores for each week (not the actual stats)

  • sleeper_conn: Sleeper: Deprecated their open API endpoint for player scores

Examples

Run this code
# NOT RUN {
conn <- fleaflicker_connect(2020, 312861)
x <- ff_playerscores(conn, page_limit = 2)
x
# }
# NOT RUN {
dlf_conn <- mfl_connect(2020, league_id = 37920)
ff_playerscores(conn = dlf_conn, season = 2019, week = "YTD")
# }

Run the code above in your browser using DataLab