From c111c951aed486697e7b28254ad2c9587d38390a Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Sun, 13 Aug 2023 16:47:08 -0400 Subject: [PATCH] fix these fucking tidyverse warnings --- DESCRIPTION | 2 +- NEWS.md | 2 + R/espn_scoringhistory.R | 15 ++- R/espn_standings.R | 8 +- R/flea_schedule.R | 7 +- R/flea_scoringhistory.R | 13 ++- R/flea_standings.R | 17 ++- R/flea_transactions.R | 226 +++++++++++++++++++++++------------- R/mfl_scoringhistory.R | 15 ++- R/sleeper_schedule.R | 18 ++- R/sleeper_scoringhistory.R | 15 ++- R/template_scoringhistory.R | 15 ++- 12 files changed, 241 insertions(+), 112 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index eb19b055..ac3b7429 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.8.07 +Version: 1.4.8.09 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index c5e168ef..2b01df2d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,8 @@ respect `season` in connection object (v1.4.8.06) (#408, thank you @RandalMorris - `ff_rosters()` fleaflicker method now accepts `week` argument (v1.4.8.06) - `ff_starters()` fleaflicker method expands to show injury data from box score and keep NA data where a player is not in a slot. (v1.4.8.07) +- Silence a whack of tidyverse crap warnings (v1.4.8.09) + # ffscrapr 1.4.8 diff --git a/R/espn_scoringhistory.R b/R/espn_scoringhistory.R index 005cba0a..d042648a 100644 --- a/R/espn_scoringhistory.R +++ b/R/espn_scoringhistory.R @@ -24,7 +24,8 @@ ff_scoringhistory.espn_conn <- function(conn, season = 1999:nflreadr::most_recen ff_scoring(conn) %>% dplyr::left_join( ffscrapr::nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "espn"), - by = c("stat_name" = "ff_event") + by = c("stat_name" = "ff_event"), + relationship = "many-to-many" ) ros <- .nflfastr_roster(season) @@ -42,8 +43,16 @@ ff_scoringhistory.espn_conn <- function(conn, season = 1999:nflreadr::most_recen } ros %>% - dplyr::inner_join(ps, by = c("gsis_id"="player_id","season")) %>% - dplyr::inner_join(league_rules, by = c("metric"="nflfastr_event","pos")) %>% + dplyr::inner_join( + ps, + by = c("gsis_id"="player_id","season"), + relationship = "many-to-many" + ) %>% + dplyr::inner_join( + league_rules, + by = c("metric"="nflfastr_event","pos"), + relationship = "many-to-many" + ) %>% dplyr::mutate(points = .data$value * .data$points) %>% dplyr::group_by(.data$season, .data$week, .data$gsis_id, .data$sportradar_id) %>% dplyr::mutate(points = round(sum(.data$points, na.rm = TRUE), 2)) %>% diff --git a/R/espn_standings.R b/R/espn_standings.R index f57943a9..61be4aec 100644 --- a/R/espn_standings.R +++ b/R/espn_standings.R @@ -40,12 +40,12 @@ ff_standings.espn_conn <- function(conn, ...) { records <- standings_init %>% - dplyr::select(.data$record) %>% + dplyr::select("record") %>% tidyr::hoist( "record", "overall" ) %>% - dplyr::select(-.data$record) %>% + dplyr::select(-"record") %>% tidyr::hoist( "overall", "h2h_wins" = "wins", @@ -55,7 +55,7 @@ ff_standings.espn_conn <- function(conn, ...) { "points_for" = "pointsFor", "points_against" = "pointsAgainst", ) %>% - dplyr::select(-.data$overall) + dplyr::select(-"overall") allplay <- ff_schedule(conn) %>% .add_allplay() @@ -65,7 +65,7 @@ ff_standings.espn_conn <- function(conn, ...) { standings <- dplyr::bind_cols( - standings_init %>% dplyr::select(-.data$record), + standings_init %>% dplyr::select(-"record"), records ) %>% dplyr::left_join(allplay, by = c("franchise_id")) %>% diff --git a/R/flea_schedule.R b/R/flea_schedule.R index e43f2d90..8685b465 100644 --- a/R/flea_schedule.R +++ b/R/flea_schedule.R @@ -105,7 +105,12 @@ ff_schedule.flea_conn <- function(conn, week = 1:17, ...) { )), dplyr::starts_with("is") ) %>% - dplyr::mutate(dplyr::across(dplyr::contains("_score"), purrr::map_dbl, ~ replace(.x, is.null(.x), NA))) + dplyr::mutate( + dplyr::across( + dplyr::contains("_score"), + function(col) purrr::map_dbl(col, ~ replace(.x, is.null(.x), NA)) + ) + ) return(schedule) } diff --git a/R/flea_scoringhistory.R b/R/flea_scoringhistory.R index 30ec6848..c308f5ac 100644 --- a/R/flea_scoringhistory.R +++ b/R/flea_scoringhistory.R @@ -27,7 +27,8 @@ ff_scoringhistory.flea_conn <- function(conn, season = 1999:nflreadr::most_recen ffscrapr::nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "fleaflicker") %>% dplyr::mutate(ff_event = as.integer(.data$ff_event)), - by = c("event_id" = "ff_event") + by = c("event_id" = "ff_event"), + relationship = "many-to-many" ) ros <- .nflfastr_roster(season) @@ -40,8 +41,14 @@ ff_scoringhistory.flea_conn <- function(conn, season = 1999:nflreadr::most_recen } ros %>% - dplyr::inner_join(ps, by = c("gsis_id"="player_id","season")) %>% - dplyr::inner_join(league_rules, by = c("metric"="nflfastr_event","pos")) %>% + dplyr::inner_join( + ps, + by = c("gsis_id"="player_id","season"), + relationship = "many-to-many") %>% + dplyr::inner_join( + league_rules, + by = c("metric"="nflfastr_event","pos"), + relationship = "many-to-many") %>% dplyr::mutate(points = .data$value * .data$points) %>% dplyr::group_by(.data$season, .data$week, .data$gsis_id, .data$sportradar_id) %>% dplyr::mutate(points = round(sum(.data$points, na.rm = TRUE), 2)) %>% diff --git a/R/flea_standings.R b/R/flea_standings.R index cd1056c2..36840fa2 100644 --- a/R/flea_standings.R +++ b/R/flea_standings.R @@ -19,7 +19,8 @@ #' #' @export ff_standings.flea_conn <- function(conn, include_allplay = TRUE, include_potentialpoints = TRUE, ...) { - standings <- fleaflicker_getendpoint("FetchLeagueStandings", + standings <- fleaflicker_getendpoint( + "FetchLeagueStandings", league_id = conn$league_id, season = conn$season, sport = "NFL" @@ -36,10 +37,15 @@ ff_standings.flea_conn <- function(conn, include_allplay = TRUE, include_potenti "points_for" = "pointsFor", "points_against" = "pointsAgainst" ) %>% - dplyr::mutate(dplyr::across(c("points_for", "points_against"), purrr::map_dbl, purrr::pluck, "value")) %>% + dplyr::mutate( + dplyr::across( + c("points_for", "points_against"), + function(col) purrr::map_dbl(col, purrr::pluck, "value") + ) + )%>% tidyr::hoist("recordOverall", "h2h_wins" = "wins", "h2h_losses" = "losses", "h2h_ties" = "ties") %>% dplyr::mutate( - dplyr::across(dplyr::starts_with("h2h"), tidyr::replace_na, 0), + dplyr::across(dplyr::starts_with("h2h"), ~tidyr::replace_na(.x,0)), h2h_winpct = (.data$h2h_wins / (.data$h2h_wins + .data$h2h_losses + .data$h2h_ties)) %>% round(3) ) %>% dplyr::select( @@ -74,14 +80,15 @@ ff_standings.flea_conn <- function(conn, include_allplay = TRUE, include_potenti dplyr::filter(!is.na(.data$result)) %>% dplyr::distinct(.data$week, .data$game_id) %>% dplyr::mutate(potentialpoints = purrr::map2(.data$week, .data$game_id, .flea_potentialpointsweek, conn)) %>% - tidyr::unnest(.data$potentialpoints) %>% + tidyr::unnest("potentialpoints") %>% dplyr::group_by(.data$franchise_id) %>% dplyr::summarise(potential_points = sum(.data$potential_points)) %>% dplyr::ungroup() } .flea_potentialpointsweek <- function(week, game_id, conn) { - x <- fleaflicker_getendpoint("FetchLeagueBoxscore", + x <- fleaflicker_getendpoint( + "FetchLeagueBoxscore", sport = "NFL", scoring_period = week, fantasy_game_id = game_id, diff --git a/R/flea_transactions.R b/R/flea_transactions.R index cb0d6d5c..a66f40fb 100644 --- a/R/flea_transactions.R +++ b/R/flea_transactions.R @@ -55,9 +55,9 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { .flea_team_transactions <- function(franchise_id, conn) { initial_results <- fleaflicker_getendpoint("FetchLeagueTransactions", - league_id = conn$league_id, - team_id = franchise_id, - result_offset = 0 + league_id = conn$league_id, + team_id = franchise_id, + result_offset = 0 ) %>% purrr::pluck("content") @@ -102,10 +102,10 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { type_desc = "added" ) %>% tidyr::hoist("transaction", - "player_id" = "id", - "player_name" = "nameFull", - "pos" = "position", - "team" = "proTeamAbbreviation" + "player_id" = "id", + "player_name" = "nameFull", + "pos" = "position", + "team" = "proTeamAbbreviation" ) %>% dplyr::select(dplyr::any_of(c( "timestamp", @@ -137,10 +137,10 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { type_desc = "dropped" ) %>% tidyr::hoist("transaction", - "player_id" = "id", - "player_name" = "nameFull", - "pos" = "position", - "team" = "proTeamAbbreviation" + "player_id" = "id", + "player_name" = "nameFull", + "pos" = "position", + "team" = "proTeamAbbreviation" ) %>% dplyr::select(dplyr::any_of(c( "timestamp", @@ -169,10 +169,10 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { tidyr::unnest_wider("transaction") %>% dplyr::mutate(player = purrr::map(.data$player, purrr::pluck, "proPlayer")) %>% tidyr::hoist("player", - "player_id" = "id", - "player_name" = "nameFull", - "pos" = "position", - "team" = "proTeamAbbreviation" + "player_id" = "id", + "player_name" = "nameFull", + "pos" = "position", + "team" = "proTeamAbbreviation" ) %>% dplyr::select(-"player", -"franchise") @@ -182,8 +182,8 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { tidyr::hoist("waiverResolutionTeams", "loser") %>% dplyr::filter(is.na(.data$loser) | !.data$loser) %>% dplyr::mutate(waiverResolutionTeams = purrr::map_dbl(.data$waiverResolutionTeams, - purrr::pluck, "team", "id", - .default = NA + purrr::pluck, "team", "id", + .default = NA )) %>% dplyr::filter(is.na(.data$waiverResolutionTeams) | .data$franchise_id == .data$waiverResolutionTeams) } @@ -210,9 +210,9 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { } .flea_transactions_trade <- function(conn) { initial_results <- fleaflicker_getendpoint("FetchTrades", - league_id = conn$league_id, - filter = "TRADES_COMPLETED", - result_offset = 0 + league_id = conn$league_id, + filter = "TRADES_COMPLETED", + result_offset = 0 ) %>% purrr::pluck("content") @@ -248,9 +248,23 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { tibble::tibble() %>% tidyr::unnest_wider(1) %>% tidyr::unnest_longer("teams") %>% - tidyr::hoist("teams", "franchise" = "team", "playersObtained", "picksObtained", "playersReleased") %>% - dplyr::mutate_at(c("playersObtained", "picksObtained", "playersReleased"), purrr::map, as.list) %>% - tidyr::hoist("franchise", "franchise_id" = "id", "franchise_name" = "name") %>% + tidyr::hoist( + "teams", + "franchise" = "team", + "playersObtained", + "picksObtained", + "playersReleased" + ) %>% + dplyr::mutate_at( + c("playersObtained", "picksObtained", "playersReleased"), + purrr::map, + as.list + ) %>% + tidyr::hoist( + "franchise", + "franchise_id" = "id", + "franchise_name" = "name" + ) %>% dplyr::mutate( trade_id = .data$id, timestamp = (as.numeric(.data$approvedOn) / 1000) %>% .as_datetime() @@ -258,26 +272,42 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { dplyr::select(-"franchise", -"approvedOn") player_trades <- trades %>% - dplyr::select("timestamp", "trade_id", "franchise_id", "franchise_name", "playersObtained") %>% + dplyr::select( + "timestamp", + "trade_id", + "franchise_id", + "franchise_name", + "playersObtained" + ) %>% tidyr::unnest_longer("playersObtained") %>% - dplyr::mutate(playersObtained = purrr::map(.data$playersObtained, purrr::pluck, "proPlayer")) %>% - tidyr::hoist("playersObtained", "player_id" = "id", "player_name" = "nameFull", "pos" = "position", "team" = "proTeamAbbreviation") %>% + dplyr::mutate( + playersObtained = purrr::map(.data$playersObtained, purrr::pluck, "proPlayer") + ) %>% + tidyr::hoist( + "playersObtained", + "player_id" = "id", + "player_name" = "nameFull", + "pos" = "position", + "team" = "proTeamAbbreviation" + ) %>% dplyr::filter(!is.na(.data$player_id)) %>% dplyr::mutate( type = "trade", player_id = as.character(.data$player_id) ) %>% - dplyr::select(dplyr::any_of(c( - "timestamp", - "type", - "trade_id", - "franchise_id", - "franchise_name", - "player_id", - "player_name", - "pos", - "team" - ))) + dplyr::select( + dplyr::any_of(c( + "timestamp", + "type", + "trade_id", + "franchise_id", + "franchise_name", + "player_id", + "player_name", + "pos", + "team" + )) + ) if (nrow(player_trades) == 0) player_trades <- tibble::tibble() @@ -296,16 +326,18 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { pos = "PICK", type = "trade" ) %>% - dplyr::select(dplyr::any_of(c( - "timestamp", - "type", - "trade_id", - "franchise_id", - "franchise_name", - "player_id", - "player_name", - "pos" - ))) + dplyr::select( + dplyr::any_of(c( + "timestamp", + "type", + "trade_id", + "franchise_id", + "franchise_name", + "player_id", + "player_name", + "pos" + )) + ) if (nrow(pick_trades) == 0) trade_cuts <- tibble::tibble() @@ -315,29 +347,43 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { dplyr::mutate_at("playersReleased", purrr::map, as.list) %>% tidyr::hoist("playersReleased", "proPlayer") %>% dplyr::mutate_at(c("proPlayer"), purrr::map, as.list) %>% - tidyr::hoist("proPlayer", "player_id" = "id", "player_name" = "nameFull", "pos" = "position", "team" = "proTeamAbbreviation") %>% + tidyr::hoist( + "proPlayer", + "player_id" = "id", + "player_name" = "nameFull", + "pos" = "position", + "team" = "proTeamAbbreviation" + ) %>% dplyr::filter(!is.na(.data$player_id)) %>% dplyr::mutate( type = "free_agency", player_id = as.character(.data$player_id), type_desc = "dropped" ) %>% - dplyr::select(dplyr::any_of(c( - "timestamp", - "type", - "trade_id", - "franchise_id", - "franchise_name", - "player_id", - "player_name", - "pos", - "team" - ))) + dplyr::select( + dplyr::any_of(c( + "timestamp", + "type", + "trade_id", + "franchise_id", + "franchise_name", + "player_id", + "player_name", + "pos", + "team" + )) + ) if (nrow(trade_cuts) == 0) trade_cuts <- tibble::tibble() df_trades <- dplyr::bind_rows(player_trades, pick_trades, trade_cuts) %>% - dplyr::group_by(.data$timestamp, .data$type, .data$trade_id, .data$franchise_id, .data$franchise_name) %>% + dplyr::group_by( + .data$timestamp, + .data$type, + .data$trade_id, + .data$franchise_id, + .data$franchise_name + ) %>% tidyr::nest() %>% dplyr::ungroup() %>% dplyr::rename("traded_for" = "data") @@ -345,31 +391,49 @@ ff_transactions.flea_conn <- function(conn, franchise_id = NULL, ...) { crossing <- df_trades %>% dplyr::left_join( df_trades %>% - dplyr::select("trade_id", "trade_partner_id" = "franchise_id", "trade_partner_name" = "franchise_name", "traded_away" = "traded_for"), + dplyr::select( + "trade_id", + "trade_partner_id" = "franchise_id", + "trade_partner_name" = "franchise_name", + "traded_away" = "traded_for"), by = "trade_id" ) %>% dplyr::filter(.data$franchise_id != .data$trade_partner_id) %>% - tidyr::pivot_longer(c("traded_for", "traded_away"), names_to = "type_desc", values_to = "player") %>% + tidyr::pivot_longer( + c("traded_for", "traded_away"), + names_to = "type_desc", + values_to = "player") %>% tidyr::unnest("player") %>% - dplyr::distinct(.data$trade_id, .data$franchise_id, .data$franchise_name, .data$type_desc, .data$player_id, .keep_all = TRUE) %>% - dplyr::mutate(type_desc = dplyr::case_when( - .data$type == "free_agency" ~ "dropped", - TRUE ~ .data$type_desc - )) %>% - dplyr::select(dplyr::any_of(c( - "timestamp", - "type", - "type_desc", - "franchise_id", - "franchise_name", - "player_id", - "player_name", - "pos", - "team", - "trade_partner_id", - "trade_partner_name", - "trade_id" - ))) + dplyr::distinct( + .data$trade_id, + .data$franchise_id, + .data$franchise_name, + .data$type_desc, + .data$player_id, + .keep_all = TRUE + ) %>% + dplyr::mutate( + type_desc = dplyr::case_when( + .data$type == "free_agency" ~ "dropped", + TRUE ~ .data$type_desc + ) + ) %>% + dplyr::select( + dplyr::any_of(c( + "timestamp", + "type", + "type_desc", + "franchise_id", + "franchise_name", + "player_id", + "player_name", + "pos", + "team", + "trade_partner_id", + "trade_partner_name", + "trade_id" + )) + ) return(crossing) } diff --git a/R/mfl_scoringhistory.R b/R/mfl_scoringhistory.R index 3c7ac858..efefd503 100644 --- a/R/mfl_scoringhistory.R +++ b/R/mfl_scoringhistory.R @@ -34,7 +34,8 @@ ff_scoringhistory.mfl_conn <- function(conn, season = 1999:nflreadr::most_recent )) %>% dplyr::left_join( ffscrapr::nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "mfl"), - by = c("event" = "ff_event") + by = c("event" = "ff_event"), + relationship = "many-to-many" ) %>% dplyr::select( "pos", "points", "lower_range", "upper_range", "event", "points_type", "nflfastr_event", "short_desc" @@ -52,8 +53,16 @@ ff_scoringhistory.mfl_conn <- function(conn, season = 1999:nflreadr::most_recent } fastr_weekly <- ros %>% - dplyr::inner_join(ps, by = c("gsis_id"="player_id","season")) %>% - dplyr::inner_join(league_rules, by = c("metric"="nflfastr_event","pos")) %>% + dplyr::inner_join( + ps, + by = c("gsis_id"="player_id","season"), + relationship = "many-to-many" + ) %>% + dplyr::inner_join( + league_rules, + by = c("metric"="nflfastr_event","pos"), + relationship = "many-to-many" + ) %>% dplyr::filter(.data$value >= .data$lower_range, .data$value <= .data$upper_range) %>% dplyr::mutate( value = dplyr::case_when(.data$points_type == "once" ~ 1, TRUE ~ .data$value), diff --git a/R/sleeper_schedule.R b/R/sleeper_schedule.R index 5e4ac555..84e86f8f 100644 --- a/R/sleeper_schedule.R +++ b/R/sleeper_schedule.R @@ -45,11 +45,20 @@ ff_schedule.sleeper_conn <- function(conn, ...) { purrr::pluck("content") %>% tibble::tibble() %>% tidyr::unnest_wider(1) %>% + dplyr::group_by(.data$matchup_id) %>% + dplyr::mutate( + opponent_id = purrr::map_int( + .data$roster_id, + ~ .data$roster_id[.data$roster_id != .x][[1]] + ) + ) %>% + dplyr::ungroup() %>% dplyr::select( dplyr::any_of( c( "franchise_id" = "roster_id", "franchise_score" = "points", + "opponent_id", "matchup_id" ) ) @@ -60,15 +69,14 @@ ff_schedule.sleeper_conn <- function(conn, ...) { dplyr::select( df_matchup, dplyr::any_of(c( - "opponent_id" = "franchise_id", - "opponent_score" = "franchise_score", - "matchup_id" + "matchup_id", + "franchise_id", + "opponent_score" = "franchise_score" )) ) %>% dplyr::filter(!is.na(.data$matchup_id)), - by = "matchup_id" + by = c("matchup_id", "opponent_id" = "franchise_id") ) %>% - dplyr::filter(.data$franchise_id != .data$opponent_id) %>% dplyr::mutate(week = week) %>% dplyr::select(dplyr::any_of(c("week", "franchise_id", "franchise_score", "opponent_id", "opponent_score"))) diff --git a/R/sleeper_scoringhistory.R b/R/sleeper_scoringhistory.R index 10bb06f6..7e730e8b 100644 --- a/R/sleeper_scoringhistory.R +++ b/R/sleeper_scoringhistory.R @@ -25,7 +25,8 @@ ff_scoringhistory.sleeper_conn <- function(conn, season = 1999:nflreadr::most_re ff_scoring(conn) %>% dplyr::left_join( ffscrapr::nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "sleeper"), - by = c("event" = "ff_event") + by = c("event" = "ff_event"), + relationship = "many-to-many" ) ros <- .nflfastr_roster(season) @@ -39,8 +40,16 @@ ff_scoringhistory.sleeper_conn <- function(conn, season = 1999:nflreadr::most_re } ros %>% - dplyr::inner_join(ps, by = c("gsis_id"="player_id","season")) %>% - dplyr::inner_join(league_rules, by = c("metric"="nflfastr_event","pos")) %>% + dplyr::inner_join( + ps, + by = c("gsis_id"="player_id","season"), + relationship = "many-to-many" + ) %>% + dplyr::inner_join( + league_rules, + by = c("metric"="nflfastr_event","pos"), + relationship = "many-to-many" + ) %>% dplyr::mutate(points = .data$value * .data$points) %>% dplyr::group_by(.data$season, .data$week, .data$gsis_id, .data$sportradar_id) %>% dplyr::mutate(points = round(sum(.data$points, na.rm = TRUE), 2)) %>% diff --git a/R/template_scoringhistory.R b/R/template_scoringhistory.R index 0b8389e3..37f1a88f 100644 --- a/R/template_scoringhistory.R +++ b/R/template_scoringhistory.R @@ -34,7 +34,8 @@ ff_scoringhistory.template_conn <- function(conn, season = 1999:nflreadr::most_r )) %>% dplyr::left_join( ffscrapr::nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "mfl"), - by = c("event" = "ff_event") + by = c("event" = "ff_event"), + relationship = "many-to-many" ) %>% dplyr::select( "pos", "points", "lower_range", "upper_range", "event", "points_type", "nflfastr_event", "short_desc" @@ -51,8 +52,16 @@ ff_scoringhistory.template_conn <- function(conn, season = 1999:nflreadr::most_r } fastr_weekly <- ros %>% - dplyr::inner_join(ps, by = c("gsis_id"="player_id","season")) %>% - dplyr::inner_join(league_rules, by = c("metric"="nflfastr_event","pos")) %>% + dplyr::inner_join( + ps, + by = c("gsis_id"="player_id","season"), + relationship = "many-to-many" + ) %>% + dplyr::inner_join( + league_rules, + by = c("metric"="nflfastr_event","pos"), + relationship = "many-to-many" + ) %>% dplyr::filter(.data$value >= .data$lower_range, .data$value <= .data$upper_range) %>% dplyr::mutate( value = dplyr::case_when(.data$points_type == "once" ~ 1, TRUE ~ .data$value),