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)

  • espn_conn: ESPN: returns total points for season and average per game, for both current and previous season.

  • 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

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_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
#> # … with 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      9360 Travis Kelce    TE    KC       16        250.      15.6     8.86
#>  2     10295 Davante Adams   WR    GB       16        325.      20.3     9.43
#>  3     11329 Stefon Diggs    WR    BUF      17        266       15.6     5.41
#>  4     12197 Tyreek Hill     WR    KC       17        280.      16.4    12.4 
#>  5     12894 Patrick Mahomes QB    KC       17        519.      30.5    11.9 
#>  6     12965 Alvin Kamara    RB    NO       13        227.      17.4     7.73
#>  7       309 Tom Brady       QB    FA       17        545.      32.1    11.8 
#>  8      3452 Aaron Rodgers   QB    GB       16        464.      29.0     9.89
#>  9      9380 Keenan Allen    WR    LAC      16        237.      14.8     4.57
#> 10     10252 Mike Evans      WR    TB       16        254.      15.9     8.87
#> # … with 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           
#> # … with 579 more rows
# }