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     13761 Josh Allen       QB    BUF      17        560.      32.9    10.0 
#>  2       309 Tom Brady        QB    TB       17        545.      32.1    11.8 
#>  3     15516 Justin Herbert   QB    LAC      17        544.      32.0    10.3 
#>  4     12894 Patrick Mahomes  QB    KC       17        519.      30.5    11.9 
#>  5      6038 Matthew Stafford QB    LAR      17        488.      28.7     7.35
#>  6      3452 Aaron Rodgers    QB    GB       16        464.      29.0     9.89
#>  7     12159 Dak Prescott     QB    DAL      16        461.      28.8    11.4 
#>  8     15532 Joe Burrow       QB    CIN      16        449.      28.1    10.4 
#>  9      8625 Kirk Cousins     QB    MIN      16        415.      26.0     7.06
#> 10     12970 Cooper Kupp      WR    LAR      17        412.      24.2     7.37
#> # … 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
# }