Skip to contents

Retrieve player fantasy points earned in each game for a given season and week (NFL) or date (NBA/MLB).

Usage

dk_get_player_fp(
  timeframe,
  season = as.numeric(format(Sys.Date(), "%Y")),
  sport = c("nfl", "nba", "mlb"),
  output = c("cleaned_json", "json", "response", "request"),
  process_args = NULL,
  ...
)

Arguments

timeframe

integer. Either the week number for NFL, or a date of the form 20230312 for MLB and NBA. If the timeframe format detected does not match the sport argument passed, an error is returned.

season

integer. optional. Defaults to the current season year.

sport

character. Defaults to NFL.

output

One of "cleaned_json" (the default), "json", "response", or "request". If "cleaned_json" then tidyjson::spread_all() is used to parse the JSON body,

process_args

Optional list of arguments passed to dk_req_process

...

Arguments passed on to dk_req

query_params

A list of query parameters passed to [httr2::req_url_query].

proxy_args

List of arguments to httr2::req_proxy

curl_options

List of arguments to httr2::req_options

throttle_rate

List of arguments to httr2::req_throttle

headers

List of arguments to httr2::req_headers()

paths

List of arguments to httr2::req_url_path_append()

error_handling_options

List of arguments to httr2::req_error()

retry_options

List of arguments passed to httr2::req_retry()

base_url

Base URL for request.

method

Custom HTTP method

Details

Data starts on October 18th, 2022 for NBA.