Get Starting Lineups
Source:R/0_generics.R
, R/espn_starters.R
, R/flea_starters.R
, and 2 more
ff_starters.Rd
This function returns a tidy dataframe with one row for every starter (and bench) for every week and their scoring, if available.
Usage
ff_starters(conn, ...)
# S3 method for espn_conn
ff_starters(conn, weeks = 1:17, ...)
# S3 method for flea_conn
ff_starters(conn, week = 1:17, ...)
# S3 method for mfl_conn
ff_starters(conn, week = 1:17, season = NULL, ...)
# S3 method for sleeper_conn
ff_starters(conn, week = 1:17, ...)
Arguments
- conn
the list object created by
ff_connect()
- ...
other arguments (currently unused)
- weeks
which weeks to calculate, a number or numeric vector
- week
a numeric or one of YTD (year-to-date) or AVG (average to date)
- season
the season of interest - generally only the most recent 2-3 seasons are available
Value
A tidy dataframe with every player for every week, including a flag for whether they were started or not
Methods (by class)
espn_conn
: ESPN: returns who was started as well as what they scored.flea_conn
: Fleaflicker: returns who was started as well as what they scored.mfl_conn
: MFL: returns the player fantasy scores for each week (not the actual stats)sleeper_conn
: Sleeper: returns only "who" was started, without any scoring/stats data. Only returns season specified in initial connection object.
Examples
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
conn <- espn_connect(season = 2020, league_id = 1178049)
ff_starters(conn, weeks = 1:3)
}) # end try
#> # A tibble: 714 × 12
#> week franchise_id franchise_name franchise_score lineup_slot player_score
#> <int> <int> <chr> <dbl> <chr> <dbl>
#> 1 1 1 Rushin' Collusion 118 QB 27.5
#> 2 1 1 Rushin' Collusion 118 RB 9.2
#> 3 1 1 Rushin' Collusion 118 RB 6.7
#> 4 1 1 Rushin' Collusion 118 WR 13.1
#> 5 1 1 Rushin' Collusion 118 WR 8.6
#> 6 1 1 Rushin' Collusion 118 WR 12.6
#> 7 1 1 Rushin' Collusion 118 TE 16.6
#> 8 1 1 Rushin' Collusion 118 DST 0
#> 9 1 1 Rushin' Collusion 118 K 9
#> 10 1 1 Rushin' Collusion 118 BE 4.8
#> # … with 704 more rows, and 6 more variables: projected_score <dbl>,
#> # player_id <int>, player_name <chr>, pos <chr>, team <chr>,
#> # eligible_lineup_slots <list>
# }
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
conn <- fleaflicker_connect(season = 2020, league_id = 206154)
ff_starters(conn)
}) # end try
# }
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
dlf_conn <- mfl_connect(2020, league_id = 37920)
ff_starters(conn = dlf_conn)
}) # end try
#> # A tibble: 6,371 × 11
#> franchise_id franchise_name season week starter_status should_start
#> <chr> <chr> <dbl> <int> <chr> <dbl>
#> 1 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 2 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 3 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 4 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 5 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 6 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 7 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 8 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 9 0013 Advance Reptilian Sola… 2020 1 starter 1
#> 10 0013 Advance Reptilian Sola… 2020 1 nonstarter 0
#> # … with 6,361 more rows, and 5 more variables: player_score <dbl>,
#> # player_id <chr>, player_name <chr>, pos <chr>, team <chr>
# }
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
jml_conn <- sleeper_connect(league_id = "522458773317046272", season = 2020)
ff_starters(jml_conn, week = 3)
}) # end try
#> # A tibble: 344 × 8
#> franchise_id franchise_name week starter_status player_id player_name pos
#> <int> <chr> <dbl> <chr> <chr> <chr> <chr>
#> 1 1 Fake News 3 nonstarter 7082 Dalton Keene TE
#> 2 1 Fake News 3 nonstarter 6826 Cole Kmet TE
#> 3 1 Fake News 3 nonstarter 6804 Jordan Love QB
#> 4 1 Fake News 3 nonstarter 676 LeSean McCoy RB
#> 5 1 Fake News 3 nonstarter 6149 Darius Slay… WR
#> 6 1 Fake News 3 nonstarter 6068 Devine Ozig… RB
#> 7 1 Fake News 3 nonstarter 6001 Drew Sample TE
#> 8 1 Fake News 3 nonstarter 5965 Miles Boykin WR
#> 9 1 Fake News 3 nonstarter 5068 Kerryon Joh… RB
#> 10 1 Fake News 3 nonstarter 5022 Dallas Goed… TE
#> # … with 334 more rows, and 1 more variable: team <chr>
# }