Get League-Specific Scoring History
Source:R/0_generics.R
, R/espn_scoringhistory.R
, R/flea_scoringhistory.R
, and 3 more
ff_scoringhistory.Rd
(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
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,962 × 37
#> season week gsis_id sportradar_id espn_id player_name pos team points
#> <dbl> <int> <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
#> 1 2020 14 00-0023482 e017e12b-07a7… 8461 Mike Nugent K ARI 14
#> 2 2020 15 00-0023482 e017e12b-07a7… 8461 Mike Nugent K ARI 8
#> 3 2020 16 00-0023482 e017e12b-07a7… 8461 Mike Nugent K ARI 7
#> 4 2020 17 00-0023482 e017e12b-07a7… 8461 Mike Nugent K ARI 1
#> 5 2020 1 00-0033862 cd0f4ef0-9914… 3043234 Zane Gonza… K ARI 6
#> 6 2020 2 00-0033862 cd0f4ef0-9914… 3043234 Zane Gonza… K ARI 13
#> 7 2020 3 00-0033862 cd0f4ef0-9914… 3043234 Zane Gonza… K ARI 6
#> 8 2020 4 00-0033862 cd0f4ef0-9914… 3043234 Zane Gonza… K ARI 3
#> 9 2020 5 00-0033862 cd0f4ef0-9914… 3043234 Zane Gonza… K ARI 7
#> 10 2020 6 00-0033862 cd0f4ef0-9914… 3043234 Zane Gonza… K ARI 8
#> # … with 5,952 more rows, and 28 more variables: fg_made_0_19 <dbl>,
#> # fg_made_20_29 <dbl>, fg_made_30_39 <dbl>, fg_made_40_49 <dbl>,
#> # fg_made_50_59 <dbl>, fg_made_60_ <dbl>, fg_missed_0_19 <dbl>,
#> # fg_missed_20_29 <dbl>, fg_missed_30_39 <dbl>, fg_missed_40_49 <dbl>,
#> # fg_missed_60_ <dbl>, pat_made <dbl>, pat_missed <dbl>, interceptions <dbl>,
#> # passing_2pt_conversions <dbl>, passing_tds <dbl>, passing_yards <dbl>,
#> # receiving_2pt_conversions <dbl>, receiving_fumbles_lost <dbl>, …
# }
# \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,400 × 24
#> season week gsis_id sportradar_id fleaflicker_id player_name pos team
#> <dbl> <int> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 2020 1 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 2 2020 2 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 3 2020 3 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 4 2020 4 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 5 2020 5 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 6 2020 6 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 7 2020 7 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 8 2020 9 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 9 2020 10 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> 10 2020 11 00-0035228 dd5a6b6e-ffae… NA Kyler Murr… QB ARI
#> # … with 5,390 more rows, and 16 more variables: points <dbl>,
#> # interceptions <dbl>, 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>
# }
# \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,400 × 26
#> season week gsis_id sportradar_id mfl_id player_name pos team points
#> <dbl> <int> <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
#> 1 2020 1 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 28.3
#> 2 2020 2 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 33.6
#> 3 2020 3 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 21.2
#> 4 2020 4 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 30.6
#> 5 2020 5 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 28.3
#> 6 2020 6 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 35.9
#> 7 2020 7 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 43.6
#> 8 2020 9 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 46.9
#> 9 2020 10 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 32.4
#> 10 2020 11 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 24.3
#> # … with 5,390 more rows, and 17 more variables: interceptions <dbl>,
#> # 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>, …
# }
# \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,951 × 32
#> season week gsis_id sportradar_id sleeper_id player_name pos team points
#> <dbl> <int> <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
#> 1 2020 14 00-0023… e017e12b-07a… 658 Mike Nugent K ARI 0
#> 2 2020 15 00-0023… e017e12b-07a… 658 Mike Nugent K ARI 0
#> 3 2020 16 00-0023… e017e12b-07a… 658 Mike Nugent K ARI 0
#> 4 2020 17 00-0023… e017e12b-07a… 658 Mike Nugent K ARI 0
#> 5 2020 1 00-0033… cd0f4ef0-991… 4233 Zane Gonza… K ARI 0
#> 6 2020 2 00-0033… cd0f4ef0-991… 4233 Zane Gonza… K ARI 0
#> 7 2020 3 00-0033… cd0f4ef0-991… 4233 Zane Gonza… K ARI 0
#> 8 2020 4 00-0033… cd0f4ef0-991… 4233 Zane Gonza… K ARI 0
#> 9 2020 5 00-0033… cd0f4ef0-991… 4233 Zane Gonza… K ARI 0
#> 10 2020 6 00-0033… cd0f4ef0-991… 4233 Zane Gonza… K ARI 0
#> # … with 5,941 more rows, and 23 more variables: fg_made_0_19 <dbl>,
#> # fg_made_20_29 <dbl>, fg_made_30_39 <dbl>, fg_made_40_49 <dbl>,
#> # fg_made_50_59 <dbl>, fg_made_60_ <dbl>, fg_missed <dbl>, pat_made <dbl>,
#> # pat_missed <dbl>, receiving_fumbles_lost <dbl>, 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>, …
# }
# \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,400 × 26
#> season week gsis_id sportradar_id mfl_id player_name pos team points
#> <dbl> <int> <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
#> 1 2020 1 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 39.3
#> 2 2020 2 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 43.6
#> 3 2020 3 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 31.7
#> 4 2020 4 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 43.6
#> 5 2020 5 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 40.8
#> 6 2020 6 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 39.4
#> 7 2020 7 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 60.6
#> 8 2020 9 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 58.4
#> 9 2020 10 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 40.4
#> 10 2020 11 00-0035228 dd5a6b6e-ffae-… 14056 Kyler Murr… QB ARI 35.8
#> # … with 5,390 more rows, and 17 more variables: completions <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_first_downs <dbl>, rushing_tds <dbl>, rushing_yards <dbl>,
#> # sacks <dbl>, special_teams_tds <dbl>, receiving_first_downs <dbl>,
#> # passing_first_downs <dbl>
# }