Get Player Scoring History
Source:R/0_generics.R
, R/espn_playerscores.R
, R/flea_playerscores.R
, and 2 more
ff_playerscores.Rd
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.
Please see ff_scoringhistory()
for an alternative reconstruction.
Usage
ff_playerscores(conn, ...)
# S3 method for class 'espn_conn'
ff_playerscores(conn, limit = 1000, ...)
# S3 method for class 'flea_conn'
ff_playerscores(conn, page_limit = NULL, ...)
# S3 method for class 'mfl_conn'
ff_playerscores(conn, season, week, ...)
# S3 method for class 'sleeper_conn'
ff_playerscores(conn, ...)
Arguments
- conn
the list object created by
ff_connect()
- ...
other arguments (currently unused)
- limit
A numeric describing the number of players to return - default 1000
- 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 vector (ie 1:17) or one of YTD (year-to-date) or AVG (average to date)
Methods (by class)
ff_playerscores(espn_conn)
: ESPN: returns total points for season and average per game, for both current and previous season.ff_playerscores(flea_conn)
: Fleaflicker: returns the season, season average, and standard deviationff_playerscores(mfl_conn)
: MFL: returns the player fantasy scores for each week (not the actual stats)ff_playerscores(sleeper_conn)
: Sleeper: Deprecated their open API endpoint for player scores
Examples
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
conn <- espn_connect(season = 2020, league_id = 899513)
ff_playerscores(conn, limit = 5)
}) # end try
#> # A tibble: 5 × 8
#> season player_id player_name pos score_total score_average franchise_id
#> <int> <int> <chr> <chr> <dbl> <dbl> <int>
#> 1 2020 3054850 Alvin Kamara RB 337. 22.5 9
#> 2 2020 3043078 Derrick Henry RB 324. 20.2 4
#> 3 2020 16800 Davante Adams WR 301. 21.5 2
#> 4 2020 15795 DeAndre Hopkins WR 230. 14.4 4
#> 5 2020 2576925 Darren Waller TE 225. 14.1 4
#> # ℹ 1 more variable: franchise_name <chr>
# }
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
conn <- fleaflicker_connect(2020, 312861)
ff_playerscores(conn, page_limit = 2)
}) # end try
#> # A tibble: 60 × 8
#> player_id player_name pos team games score_total score_avg score_sd
#> <int> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 13761 Josh Allen QB BUF 16 550. 34.4 10.4
#> 2 3452 Aaron Rodgers QB NYJ 16 542. 33.8 8.49
#> 3 12894 Patrick Mahomes QB KC 15 520. 34.6 9.95
#> 4 8598 Russell Wilson QB PIT 16 513. 32.1 10.8
#> 5 14664 Kyler Murray QB ARI 16 507. 31.7 11.9
#> 6 12919 Deshaun Watson QB CLE 16 503. 31.5 7.96
#> 7 309 Tom Brady QB FA 16 488. 30.5 12.2
#> 8 8514 Ryan Tannehill QB FA 16 469. 29.3 9.76
#> 9 15516 Justin Herbert QB LAC 15 459. 30.6 9.67
#> 10 8625 Kirk Cousins QB ATL 16 446. 27.9 9.8
#> # ℹ 50 more rows
# }
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
sfb_conn <- mfl_connect(2020, league_id = 65443)
ff_playerscores(conn = sfb_conn, season = 2019, week = "YTD")
}) # end try
#> # A tibble: 589 × 8
#> season week player_id player_name pos team points is_available
#> <dbl> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 2019 YTD 13593 Jackson, Lamar QB BAL 489. 1
#> 2 2019 YTD 13130 McCaffrey, Christian RB CAR 447. 1
#> 3 2019 YTD 12652 Thomas, Michael WR NOS 338. 1
#> 4 2019 YTD 13113 Watson, Deshaun QB HOU 330. 1
#> 5 2019 YTD 11244 Kelce, Travis TE KCC 317. 1
#> 6 2019 YTD 10703 Wilson, Russell QB SEA 315. 1
#> 7 2019 YTD 12620 Prescott, Dak QB DAL 314. 1
#> 8 2019 YTD 13128 Cook, Dalvin RB MIN 313. 1
#> 9 2019 YTD 13319 Jones, Aaron RB GBP 312 1
#> 10 2019 YTD 12625 Elliott, Ezekiel RB DAL 309. 1
#> # ℹ 579 more rows
# }