Skip to contents

Attaches projected scores to rosters (via an inner-join) and creates a positional ranking column.

Usage

ffs_score_rosters(projected_scores, rosters)

Arguments

projected_scores

a dataframe of projected scores, as created by ffs_generate_projections()

rosters

a dataframe of rosters, as created by ffs_rosters()

Value

A dataframe of roster-level projected scores

See also

vignette("custom") for example usage

Examples

# \donttest{
# cached examples
projected_scores <- .ffs_cache("projected_scores.rds")
rosters <- .ffs_cache("mfl_rosters.rds")

ffs_score_rosters(projected_scores, rosters)
#>       fantasypros_id franchise_id franchise_name player_id   player_name pos
#>    1:          10007         0007     Paw Patrol     10413 Taylor, Tyrod  QB
#>    2:          10007         0007     Paw Patrol     10413 Taylor, Tyrod  QB
#>    3:          10007         0007     Paw Patrol     10413 Taylor, Tyrod  QB
#>    4:          10007         0007     Paw Patrol     10413 Taylor, Tyrod  QB
#>    5:          10007         0007     Paw Patrol     10413 Taylor, Tyrod  QB
#>   ---                                                                       
#> 2204:           9907         0007     Paw Patrol     10313  Dalton, Andy  QB
#> 2205:           9907         0007     Paw Patrol     10313  Dalton, Andy  QB
#> 2206:           9907         0007     Paw Patrol     10313  Dalton, Andy  QB
#> 2207:           9907         0007     Paw Patrol     10313  Dalton, Andy  QB
#> 2208:           9907         0007     Paw Patrol     10313  Dalton, Andy  QB
#>       team  age league_id   ecr rank projection gp_model season week
#>    1:  HOU 32.1     22627 32.93   32      16.88        1      2    1
#>    2:  HOU 32.1     22627 32.93   32       6.48        1      2    2
#>    3:  HOU 32.1     22627 32.93   32       1.16        1      2    3
#>    4:  HOU 32.1     22627 32.93   33      16.32        1      1    1
#>    5:  HOU 32.1     22627 32.93   33      15.64        0      1    2
#>   ---                                                               
#> 2204:  CHI 33.9     22627 35.81   36      23.68        0      1    2
#> 2205:  CHI 33.9     22627 35.81   36      24.22        0      1    3
#> 2206:  CHI 33.9     22627 35.81   37      18.94        0      2    1
#> 2207:  CHI 33.9     22627 35.81   37       1.70        1      2    2
#> 2208:  CHI 33.9     22627 35.81   37       2.32        0      2    3
#>       projected_score scrape_date pos_rank
#>    1:           16.88  2021-09-03        2
#>    2:            6.48  2021-09-03        4
#>    3:            1.16  2021-09-03        4
#>    4:           16.32  2021-09-03        3
#>    5:            0.00  2021-09-03        2
#>   ---                                     
#> 2204:            0.00  2021-09-03        6
#> 2205:            0.00  2021-09-03        6
#> 2206:            0.00  2021-09-03        6
#> 2207:            1.70  2021-09-03        5
#> 2208:            0.00  2021-09-03        6
# }