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)

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

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

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

  • 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 franchise_id franchise_name          franchise_score result opponent_id
#>    <int>        <int> <chr>                             <dbl> <chr>        <int>
#>  1     2      1373991 Top City Terrors                   226. WIN        1373393
#>  2     2      1373480 Goldenrod City Nightma…            161. LOSE       1373475
#>  3     2      1371776 Winter Hill Black Sham…            178. WIN        1373501
#>  4     2      1373993 Boomtown Sly Foxes                 167. WIN        1373970
#>  5     2      1373883 Manitoba Marmots                   201. WIN        1373973
#>  6     2      1373535 Winterthur Angry Ducks             147. LOSE       1373988
#>  7     2      1374252 Central City Crusaders             160. LOSE       1374255
#>  8     2      1374271 Clutch City Ballers                174. WIN        1374315
#>  9     2      1373393 Philadelphia Fire                  138. LOSE       1373991
#> 10     2      1373475 Winterfell Dire Wolves             300. WIN        1373480
#> # … with 38 more rows, and 8 more variables: opponent_name <chr>,
#> #   opponent_score <dbl>, game_id <chr>, isFinalScore <lgl>,
#> #   isDivisional <lgl>, isPlayoffs <lgl>, isThirdPlaceGame <lgl>,
#> #   isChampionshipGame <lgl>
# }

# \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
# }