Skip to contents

(Experimental!) This function reads your league's ff_scoring rules and maps them to nflfastr week-level data. Not all of the scoring rules from your league may have nflfastr equivalents, but most of the common ones are available!

Usage

ff_scoringhistory(conn, season, ...)

# S3 method for espn_conn
ff_scoringhistory(conn, season = 1999:nflreadr::most_recent_season(), ...)

# S3 method for flea_conn
ff_scoringhistory(conn, season = 1999:nflreadr::most_recent_season(), ...)

# S3 method for mfl_conn
ff_scoringhistory(conn, season = 1999:nflreadr::most_recent_season(), ...)

# S3 method for sleeper_conn
ff_scoringhistory(conn, season = 1999:nflreadr::most_recent_season(), ...)

# S3 method for template_conn
ff_scoringhistory(conn, season = 1999:nflreadr::most_recent_season(), ...)

Arguments

conn

a conn object created by ff_connect()

season

season a numeric vector of seasons (earliest available year is 1999)

...

other arguments

Value

A tidy dataframe of weekly fantasy scoring data, one row per player per week

Methods (by class)

  • espn_conn: ESPN: returns scoring history in a flat table, one row per player per week.

  • flea_conn: Fleaflicker: returns scoring history in a flat table, one row per player per week.

  • mfl_conn: MFL: returns scoring history in a flat table, one row per player per week.

  • sleeper_conn: Sleeper: returns scoring history in a flat table, one row per player per week.

  • template_conn: template: returns scoring history in a flat table, one row per player per week.

Examples

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  conn <- espn_connect(season = 2020, league_id = 899513)
  ff_scoringhistory(conn, season = 2020)
}) # end try
#> # A tibble: 5,397 × 24
#>    season  week gsis_id    sportrad…¹ espn_id playe…² pos   team  points inter…³
#>     <int> <int> <chr>      <chr>      <chr>   <chr>   <chr> <chr>  <dbl>   <dbl>
#>  1   2020    15 00-0034490 83849bc5-… 3894901 Ezekie… LB    ARI      3.1       0
#>  2   2020     1 00-0035752 23461354-… 3040206 Chris … QB    ARI      0.3       0
#>  3   2020    17 00-0035752 23461354-… 3040206 Chris … QB    ARI      7.4       1
#>  4   2020     1 00-0035228 dd5a6b6e-… 3917315 Kyler … QB    ARI     26.3       1
#>  5   2020     2 00-0035228 dd5a6b6e-… 3917315 Kyler … QB    ARI     32.1       1
#>  6   2020     3 00-0035228 dd5a6b6e-… 3917315 Kyler … QB    ARI     21.7       3
#>  7   2020     4 00-0035228 dd5a6b6e-… 3917315 Kyler … QB    ARI     23.1       0
#>  8   2020     5 00-0035228 dd5a6b6e-… 3917315 Kyler … QB    ARI     26.3       1
#>  9   2020     6 00-0035228 dd5a6b6e-… 3917315 Kyler … QB    ARI     28.9       0
#> 10   2020     7 00-0035228 dd5a6b6e-… 3917315 Kyler … QB    ARI     37.1       1
#> # … with 5,387 more rows, 14 more variables: passing_2pt_conversions <dbl>,
#> #   passing_tds <dbl>, passing_yards <dbl>, receiving_2pt_conversions <dbl>,
#> #   receiving_fumbles_lost <dbl>, receiving_tds <dbl>, receiving_yards <dbl>,
#> #   receptions <dbl>, rushing_2pt_conversions <dbl>,
#> #   rushing_fumbles_lost <dbl>, rushing_tds <dbl>, rushing_yards <dbl>,
#> #   sack_fumbles_lost <dbl>, special_teams_tds <dbl>, and abbreviated variable
#> #   names ¹​sportradar_id, ²​player_name, ³​interceptions
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  conn <- fleaflicker_connect(2020, 312861)
  ff_scoringhistory(conn, season = 2020)
}) # end try
#> # A tibble: 5,392 × 24
#>    season  week gsis_id    sportrad…¹ fleaf…² playe…³ pos   team  points inter…⁴
#>     <int> <int> <chr>      <chr>      <chr>   <chr>   <chr> <chr>  <dbl>   <dbl>
#>  1   2020     1 00-0035752 23461354-… NA      Chris … QB    ARI     0.55       0
#>  2   2020    17 00-0035752 23461354-… NA      Chris … QB    ARI    11.9        1
#>  3   2020     1 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    33.3        1
#>  4   2020     2 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    39.1        1
#>  5   2020     3 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    33.4        3
#>  6   2020     4 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    34.6        0
#>  7   2020     5 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    34.6        1
#>  8   2020     6 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    36.2        0
#>  9   2020     7 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    49.6        1
#> 10   2020     9 00-0035228 dd5a6b6e-… NA      Kyler … QB    ARI    51.7        0
#> # … with 5,382 more rows, 14 more variables: passing_2pt_conversions <dbl>,
#> #   passing_first_downs <dbl>, passing_tds <dbl>, passing_yards <dbl>,
#> #   receiving_2pt_conversions <dbl>, receiving_first_downs <dbl>,
#> #   receiving_tds <dbl>, receiving_yards <dbl>, receptions <dbl>,
#> #   rushing_2pt_conversions <dbl>, rushing_first_downs <dbl>,
#> #   rushing_tds <dbl>, rushing_yards <dbl>, special_teams_tds <dbl>, and
#> #   abbreviated variable names ¹​sportradar_id, ²​fleaflicker_id, ³​player_name, …
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  ssb_conn <- ff_connect(platform = "mfl", league_id = 54040, season = 2020)
  ff_scoringhistory(ssb_conn, season = 2020)
}) # end try
#> # A tibble: 5,392 × 26
#>    season  week gsis_id    sportrada…¹ mfl_id playe…² pos   team  points inter…³
#>     <int> <int> <chr>      <chr>       <chr>  <chr>   <chr> <chr>  <dbl>   <dbl>
#>  1   2020     1 00-0035752 23461354-f… 15060  Chris … QB    ARI      0.8       0
#>  2   2020    17 00-0035752 23461354-f… 15060  Chris … QB    ARI      7.9       1
#>  3   2020     1 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     28.3       1
#>  4   2020     2 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     33.6       1
#>  5   2020     3 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     21.2       3
#>  6   2020     4 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     30.6       0
#>  7   2020     5 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     28.3       1
#>  8   2020     6 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     35.9       0
#>  9   2020     7 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     43.6       1
#> 10   2020     9 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     46.9       0
#> # … with 5,382 more rows, 16 more variables: passing_2pt_conversions <dbl>,
#> #   passing_tds <dbl>, passing_yards <dbl>, receiving_2pt_conversions <dbl>,
#> #   receiving_fumbles_lost <dbl>, receiving_tds <dbl>, receiving_yards <dbl>,
#> #   receptions <dbl>, rushing_2pt_conversions <dbl>, rushing_first_downs <dbl>,
#> #   rushing_fumbles_lost <dbl>, rushing_tds <dbl>, rushing_yards <dbl>,
#> #   sack_fumbles_lost <dbl>, special_teams_tds <dbl>,
#> #   receiving_first_downs <dbl>, and abbreviated variable names …
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  conn <- ff_connect(platform = "sleeper", league_id = "522458773317046272", season = 2020)
  ff_scoringhistory(conn, season = 2020)
}) # end try
#> # A tibble: 5,417 × 23
#>    season  week gsis_id    sportrad…¹ sleep…² playe…³ pos   team  points recei…⁴
#>     <int> <int> <chr>      <chr>      <chr>   <chr>   <chr> <chr>  <dbl>   <dbl>
#>  1   2020    15 00-0034490 83849bc5-… 5161    Ezekie… LB    ARI      0         0
#>  2   2020     1 00-0035752 23461354-… 6778    Chris … QB    ARI      0.3       0
#>  3   2020    17 00-0035752 23461354-… 6778    Chris … QB    ARI      7.4       0
#>  4   2020     1 00-0035228 dd5a6b6e-… 5849    Kyler … QB    ARI     26.3       0
#>  5   2020     2 00-0035228 dd5a6b6e-… 5849    Kyler … QB    ARI     32.1       0
#>  6   2020     3 00-0035228 dd5a6b6e-… 5849    Kyler … QB    ARI     21.7       0
#>  7   2020     4 00-0035228 dd5a6b6e-… 5849    Kyler … QB    ARI     23.1       0
#>  8   2020     5 00-0035228 dd5a6b6e-… 5849    Kyler … QB    ARI     26.3       0
#>  9   2020     6 00-0035228 dd5a6b6e-… 5849    Kyler … QB    ARI     28.9       0
#> 10   2020     7 00-0035228 dd5a6b6e-… 5849    Kyler … QB    ARI     37.1       0
#> # … with 5,407 more rows, 13 more variables: rushing_fumbles_lost <dbl>,
#> #   sack_fumbles_lost <dbl>, interceptions <dbl>,
#> #   passing_2pt_conversions <dbl>, passing_tds <dbl>, passing_yards <dbl>,
#> #   receiving_2pt_conversions <dbl>, receiving_tds <dbl>,
#> #   receiving_yards <dbl>, receptions <dbl>, rushing_2pt_conversions <dbl>,
#> #   rushing_tds <dbl>, rushing_yards <dbl>, and abbreviated variable names
#> #   ¹​sportradar_id, ²​sleeper_id, ³​player_name, ⁴​receiving_fumbles_lost
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  template_conn <- ff_template(scoring_type = "sfb11", roster_type = "sfb11")
  ff_scoringhistory(template_conn, season = 2020)
}) # end try
#> # A tibble: 5,392 × 26
#>    season  week gsis_id    sportrada…¹ mfl_id playe…² pos   team  points compl…³
#>     <int> <int> <chr>      <chr>       <chr>  <chr>   <chr> <chr>  <dbl>   <dbl>
#>  1   2020     1 00-0035752 23461354-f… 15060  Chris … QB    ARI      0.8       0
#>  2   2020    17 00-0035752 23461354-f… 15060  Chris … QB    ARI     11.4      11
#>  3   2020     1 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     39.3      26
#>  4   2020     2 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     43.6      26
#>  5   2020     3 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     31.7      23
#>  6   2020     4 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     43.6      24
#>  7   2020     5 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     40.8      27
#>  8   2020     6 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     39.4       9
#>  9   2020     7 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     60.6      34
#> 10   2020     9 00-0035228 dd5a6b6e-f… 14056  Kyler … QB    ARI     58.4      21
#> # … with 5,382 more rows, 16 more variables: interceptions <dbl>,
#> #   passing_2pt_conversions <dbl>, passing_tds <dbl>, passing_yards <dbl>,
#> #   receiving_2pt_conversions <dbl>, receiving_tds <dbl>,
#> #   receiving_yards <dbl>, receptions <dbl>, rushing_2pt_conversions <dbl>,
#> #   rushing_first_downs <dbl>, rushing_tds <dbl>, rushing_yards <dbl>,
#> #   sacks <dbl>, special_teams_tds <dbl>, receiving_first_downs <dbl>,
#> #   passing_first_downs <dbl>, and abbreviated variable names ¹​sportradar_id, …
# }