Skip to contents

This function returns a tidy dataframe with one row for every team for every weekly matchup

Usage

ff_schedule(conn, ...)

# S3 method for espn_conn
ff_schedule(conn, ...)

# S3 method for flea_conn
ff_schedule(conn, week = 1:17, ...)

# S3 method for mfl_conn
ff_schedule(conn, ...)

# S3 method for sleeper_conn
ff_schedule(conn, ...)

Arguments

conn

a conn object created by ff_connect()

...

for other platforms

week

a numeric or numeric vector specifying which weeks to pull

Value

A tidy dataframe with one row per game per franchise per week

Methods (by class)

  • ff_schedule(espn_conn): ESPN: returns schedule data, one row for every franchise for every week. Completed games have result data.

  • ff_schedule(flea_conn): Flea: returns schedule data, one row for every franchise for every week. Completed games have result data.

  • ff_schedule(mfl_conn): MFL: returns schedule data, one row for every franchise for every week. Completed games have result data.

  • ff_schedule(sleeper_conn): Sleeper: returns all schedule data

Examples

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  espn_conn <- espn_connect(season = 2020, league_id = 899513)
  ff_schedule(espn_conn)
}) # end try
#> # A tibble: 140 × 6
#>     week franchise_id franchise_score result opponent_id opponent_score
#>    <int>        <int>           <dbl> <chr>        <int>          <dbl>
#>  1     1            1            102. L                4           130.
#>  2     1            2            156. W                3           135.
#>  3     1            3            135. L                2           156.
#>  4     1            4            130. W                1           102.
#>  5     1            5            133. W                7           131.
#>  6     1            6            119. L                9           124.
#>  7     1            7            131. L                5           133.
#>  8     1            8            120. L               10           122.
#>  9     1            9            124. W                6           119.
#> 10     1           10            122. W                8           120.
#> # … with 130 more rows
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  conn <- fleaflicker_connect(season = 2019, league_id = 206154)
  ff_schedule(conn, week = 2:4)
}) # end try
#> # A tibble: 48 × 14
#>     week franch…¹ franc…² franc…³ result oppon…⁴ oppon…⁵ oppon…⁶ game_id isFin…⁷
#>    <int>    <int> <chr>     <dbl> <chr>    <int> <chr>     <dbl> <chr>   <lgl>  
#>  1     2  1373991 Top Ci…    226. WIN    1373393 Philad…    138. 425065… TRUE   
#>  2     2  1373480 Golden…    161. LOSE   1373475 Winter…    300. 422451… TRUE   
#>  3     2  1371776 Winter…    178. WIN    1373501 Midgar…    172. 425065… TRUE   
#>  4     2  1373993 Boomto…    167. WIN    1373970 Bamend…    159. 422451… TRUE   
#>  5     2  1373883 Manito…    201. WIN    1373973 Red Ri…    103. 425065… TRUE   
#>  6     2  1373535 Winter…    147. LOSE   1373988 Spring…    229. 425065… TRUE   
#>  7     2  1374252 Centra…    160. LOSE   1374255 Mushro…    210. 422451… TRUE   
#>  8     2  1374271 Clutch…    174. WIN    1374315 Shangh…    132. 422451… TRUE   
#>  9     2  1373393 Philad…    138. LOSE   1373991 Top Ci…    226. 425065… TRUE   
#> 10     2  1373475 Winter…    300. WIN    1373480 Golden…    161. 422451… TRUE   
#> # … with 38 more rows, 4 more variables: isDivisional <lgl>, isPlayoffs <lgl>,
#> #   isThirdPlaceGame <lgl>, isChampionshipGame <lgl>, and abbreviated variable
#> #   names ¹​franchise_id, ²​franchise_name, ³​franchise_score, ⁴​opponent_id,
#> #   ⁵​opponent_name, ⁶​opponent_score, ⁷​isFinalScore
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  ssb_conn <- ff_connect(platform = "mfl", league_id = 54040, season = 2020)
  ff_schedule(ssb_conn)
}) # end try
#> # A tibble: 234 × 6
#>     week franchise_id franchise_score result opponent_id opponent_score
#>    <dbl> <chr>                  <dbl> <chr>  <chr>                <dbl>
#>  1     1 0001                    123. W      0002                  103.
#>  2     1 0002                    103. L      0001                  123.
#>  3     1 0003                    128. L      0004                  174.
#>  4     1 0004                    174. W      0003                  128.
#>  5     1 0005                    144. W      0011                  130.
#>  6     1 0006                    173. W      0013                  125.
#>  7     1 0007                    145. W      0010                  127.
#>  8     1 0008                    185. W      0009                  176.
#>  9     1 0009                    176. L      0008                  185.
#> 10     1 0010                    127. L      0007                  145.
#> # … with 224 more rows
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  jml_conn <- ff_connect(platform = "sleeper", league_id = "522458773317046272", season = 2020)
  ff_schedule(jml_conn)
}) # end try
#> # A tibble: 184 × 6
#>     week franchise_id franchise_score opponent_id opponent_score result
#>    <int>        <int>           <dbl>       <int>          <dbl> <chr> 
#>  1     1            1            97.8          12          160.  L     
#>  2     1            2            65.9           8           70.2 L     
#>  3     1            3           103.           10           71   W     
#>  4     1            4           133.            7          106.  W     
#>  5     1            5            82.4           6           99.3 L     
#>  6     1            6            99.3           5           82.4 W     
#>  7     1            7           106.            4          133.  L     
#>  8     1            8            70.2           2           65.9 W     
#>  9     1            9            78.3          11          147   L     
#> 10     1           10            71             3          103.  L     
#> # … with 174 more rows
# }