Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed TE Overall Fantasy Standings Table #15

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions R/create_gt_ovr_fantasy_standings.R
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,20 @@ table_ovr_te_fantasy <- function(num_players = NULL,
output_dir = NULL
) {

te_pbp_stats <- nuclearff::get_wr_pbp_stats(pbp_db,
te_pbp_stats <- nuclearff::get_te_pbp_stats(pbp_db,
pbp_db_tbl,
seasons,
week_min = 1
) %>%
# Clean up player names in defined player column
nuclearff::replace_player_names(player_col = "player_display_name")
nuclearff::replace_player_names(player_col = "player_display_name") %>%
# Clean up team names e.g., LA to LAR
nuclearff::replace_team_names() %>%
# Redefine position for the strange case of Taysom Hill to "TE"
dplyr::mutate(position = dplyr::case_when(
player_display_name == "Taysom Hill" ~ "TE",
TRUE ~ position
))

# Pull WR roster information and player IDs
te_data <- nuclearff::get_player_data(seasons,
Expand All @@ -687,7 +694,7 @@ table_ovr_te_fantasy <- function(num_players = NULL,
)

# Add snap share to data
snap_pct <- nuclearff::get_snap_share(season = seasons, pos = "WR") %>%
snap_pct <- nuclearff::get_snap_share(season = seasons, pos = "TE") %>%
# Clean up player names in defined player column
nuclearff::replace_player_names(player_col = "player")

Expand Down Expand Up @@ -717,10 +724,10 @@ table_ovr_te_fantasy <- function(num_players = NULL,
) %>%
# Arrange by total fantasy points descending
dplyr::arrange(dplyr::desc(fpts)) %>%
# Only keep the top 16 WR
# Only keep the top 16 TE
utils::head(num_players) %>%
# mutate(OVR = 1:16) %>% # Add the OVERALL column
mutate(OVR = paste0("WR", 1:num_players)) %>% # Combine "WR" with the numbers 1 to 16
# Combine "TE" with the numbers 1 to 16
mutate(OVR = paste0("TE", 1:num_players)) %>%
select(OVR, everything()) # Move OVERALL to the first column

# Get the max week - current week
Expand Down
Loading