Skip to contents

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 espn_conn
ff_playerscores(conn, limit = 1000, ...)

# 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)

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)

Value

A tibble of historical player scoring

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 deviation

  • ff_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

See also

ff_scoringhistory

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_ave…¹ franc…² franc…³
#>    <int>     <int> <chr>           <chr>       <dbl>       <dbl>   <int> <chr>  
#> 1   2020   3054850 Alvin Kamara    RB           337.        22.5       9 "RAFI …
#> 2   2020   3043078 Derrick Henry   RB           324.        20.2       4 "I'm A…
#> 3   2020     16800 Davante Adams   WR           301.        21.5       2 "Coom …
#> 4   2020     15795 DeAndre Hopkins WR           230.        14.4       4 "I'm A…
#> 5   2020   2576925 Darren Waller   TE           225.        14.1       4 "I'm A…
#> # … with abbreviated variable names ¹​score_average, ²​franchise_id,
#> #   ³​franchise_name
# }
# \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…¹
#>        <int> <chr>               <chr> <chr> <dbl>       <dbl>     <dbl>   <dbl>
#>  1      9360 Travis Kelce        TE    KC       NA          NA        NA      NA
#>  2     10295 Davante Adams       WR    LV       NA          NA        NA      NA
#>  3     11329 Stefon Diggs        WR    BUF      NA          NA        NA      NA
#>  4     12197 Tyreek Hill         WR    MIA      NA          NA        NA      NA
#>  5     12892 Christian McCaffrey RB    SF       NA          NA        NA      NA
#>  6     12894 Patrick Mahomes     QB    KC       NA          NA        NA      NA
#>  7     12929 Dalvin Cook         RB    MIN      NA          NA        NA      NA
#>  8     12975 Joe Mixon           RB    CIN      NA          NA        NA      NA
#>  9     13023 George Kittle       TE    SF       NA          NA        NA      NA
#> 10     13325 Austin Ekeler       RB    LAC      NA          NA        NA      NA
#> # … with 50 more rows, and abbreviated variable name ¹​score_sd
# }
# \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           
#> # … with 579 more rows
# }