From e094aed138e094558bf7e38deb644b10f265e5a1 Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Tue, 13 Apr 2021 11:01:45 -0400 Subject: [PATCH 01/13] add release_bullets --- R/0_helpers.R | 13 +++++++++++++ man/release_questions.Rd | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 man/release_questions.Rd diff --git a/R/0_helpers.R b/R/0_helpers.R index 27980cae..287bb903 100644 --- a/R/0_helpers.R +++ b/R/0_helpers.R @@ -150,3 +150,16 @@ set_unescaped_cookies <- function(...) { httr::config(cookie = cookie) } + +#' Release questions +#' +#' @keywords internal +#' +release_bullets <- function(){ + + c( + "Tag the current version of ffscrapr-tests as a release version", + 'Switch all vignettes and tests to use "ffscrapr-tests-v1.x.x" and download "archive/v1.x.x"' + ) + +} diff --git a/man/release_questions.Rd b/man/release_questions.Rd new file mode 100644 index 00000000..9344c9c1 --- /dev/null +++ b/man/release_questions.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/0_helpers.R +\name{release_questions} +\alias{release_questions} +\title{Release questions} +\usage{ +release_questions() +} +\description{ +Release questions +} +\keyword{internal} From 9f289d36dbc8760cf042a0d598eb784e4c567507 Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Tue, 13 Apr 2021 11:05:46 -0400 Subject: [PATCH 02/13] switch test infrastructure back to dev, changever to .01 --- DESCRIPTION | 2 +- NEWS.md | 8 ++++++++ README.Rmd | 6 +++--- tests/testthat/setup.R | 6 +++--- tests/testthat/test-ff_scoringhistory.R | 4 ++-- vignettes/espn_basics.Rmd | 6 +++--- vignettes/espn_getendpoint.Rmd | 6 +++--- vignettes/ffscrapr_scoringhistory.Rmd | 4 ++-- vignettes/fleaflicker_basics.Rmd | 6 +++--- vignettes/fleaflicker_getendpoint.Rmd | 6 +++--- vignettes/mfl_basics.Rmd | 6 +++--- vignettes/mfl_getendpoint.Rmd | 6 +++--- vignettes/sleeper_basics.Rmd | 6 +++--- vignettes/sleeper_getendpoint.Rmd | 6 +++--- 14 files changed, 43 insertions(+), 35 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 40e672bb..e414e7d5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.0 +Version: 1.4.0.01 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index f4dbf19e..9a71328d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# ffscrapr (development version) + +## Notes + +- Added `release_questions` to help remind me to maintain test infrastructure + +--- + # ffscrapr 1.4.0 The main goal of v1.4.0 is to add preliminary support for connecting ffscrapr to nflfastR weekly data, and to clean up bugs from v1.3.0. Huge thanks goes to [Joe Sydlowski](https://twitter.com/JoeSydlowskiFF) for his contributions on scoring history (and everything else DynastyProcess!) diff --git a/README.Rmd b/README.Rmd index fd3308c2..cb3c3b50 100644 --- a/README.Rmd +++ b/README.Rmd @@ -23,10 +23,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -109,5 +109,5 @@ The APIs and data accessed by this package belong to their respective owners, an ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 6fba366c..6c31d7ec 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -15,13 +15,13 @@ skip <- FALSE if (download_mock) { tryCatch( expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip", "f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip", "f.zip") unzip("f.zip", exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0") + httptest::.mockPaths(new = "ffscrapr-tests-main") withr::defer( - unlink(c("ffscrapr-tests-1.4.0", "f.zip"), recursive = TRUE, force = TRUE), + unlink(c("ffscrapr-tests-main", "f.zip"), recursive = TRUE, force = TRUE), testthat::teardown_env() ) }, diff --git a/tests/testthat/test-ff_scoringhistory.R b/tests/testthat/test-ff_scoringhistory.R index 40df0296..2aae334c 100644 --- a/tests/testthat/test-ff_scoringhistory.R +++ b/tests/testthat/test-ff_scoringhistory.R @@ -4,9 +4,9 @@ with_mock_api({ if (!identical(Sys.getenv("MOCK_BYPASS"), "true")) { testthat::local_mock( - nflfastr_weekly = function() readRDS("ffscrapr-tests-1.4.0/gh_nflfastr/player_stats.rds"), + nflfastr_weekly = function() readRDS("ffscrapr-tests-main/gh_nflfastr/player_stats.rds"), nflfastr_rosters = function(seasons) { - purrr::map_df(seasons, ~ readRDS(glue::glue("ffscrapr-tests-1.4.0/gh_nflfastr/roster_{.x}.rds"))) + purrr::map_df(seasons, ~ readRDS(glue::glue("ffscrapr-tests-main/gh_nflfastr/roster_{.x}.rds"))) } ) } diff --git a/vignettes/espn_basics.Rmd b/vignettes/espn_basics.Rmd index ba2a1cae..e38ba0a7 100644 --- a/vignettes/espn_basics.Rmd +++ b/vignettes/espn_basics.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -158,6 +158,6 @@ In this vignette, I've used only a few functions: ff_connect, ff_league, ff_rost ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/espn_getendpoint.Rmd b/vignettes/espn_getendpoint.Rmd index 1d759bd2..febca384 100644 --- a/vignettes/espn_getendpoint.Rmd +++ b/vignettes/espn_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -153,5 +153,5 @@ Many of the API endpoints are being researched in other languages and you might ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/ffscrapr_scoringhistory.Rmd b/vignettes/ffscrapr_scoringhistory.Rmd index a51912f6..61bd300b 100644 --- a/vignettes/ffscrapr_scoringhistory.Rmd +++ b/vignettes/ffscrapr_scoringhistory.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) diff --git a/vignettes/fleaflicker_basics.Rmd b/vignettes/fleaflicker_basics.Rmd index f7c1bdbf..67c019d9 100644 --- a/vignettes/fleaflicker_basics.Rmd +++ b/vignettes/fleaflicker_basics.Rmd @@ -21,10 +21,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -160,6 +160,6 @@ In this vignette, I've used only a few functions: ff_connect, ff_league, ff_rost ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/fleaflicker_getendpoint.Rmd b/vignettes/fleaflicker_getendpoint.Rmd index b896d6e3..7a7a4e46 100644 --- a/vignettes/fleaflicker_getendpoint.Rmd +++ b/vignettes/fleaflicker_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -121,6 +121,6 @@ From here, you can keep unravelling - including the "viewingActualPoints" and "v ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/mfl_basics.Rmd b/vignettes/mfl_basics.Rmd index 84a2f48d..7b024613 100644 --- a/vignettes/mfl_basics.Rmd +++ b/vignettes/mfl_basics.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -155,6 +155,6 @@ Now that you've gotten this far, why not check out some of the other possibiliti ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/mfl_getendpoint.Rmd b/vignettes/mfl_getendpoint.Rmd index 4a3af73a..e3ff61f5 100644 --- a/vignettes/mfl_getendpoint.Rmd +++ b/vignettes/mfl_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -103,5 +103,5 @@ head(fog_tradebait) ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/sleeper_basics.Rmd b/vignettes/sleeper_basics.Rmd index b76bd70b..375876a6 100644 --- a/vignettes/sleeper_basics.Rmd +++ b/vignettes/sleeper_basics.Rmd @@ -21,10 +21,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -165,6 +165,6 @@ In this vignette, I've used ~three functions: ff_connect, ff_league, and ff_rost ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/sleeper_getendpoint.Rmd b/vignettes/sleeper_getendpoint.Rmd index 5d3b3697..1ea4504a 100644 --- a/vignettes/sleeper_getendpoint.Rmd +++ b/vignettes/sleeper_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.0.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-1.4.0")}, + httptest::.mockPaths(new = "ffscrapr-tests-main")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -93,6 +93,6 @@ There - this means something to us now! As of this writing (2020-11-10), Kalen B ```{r include = FALSE, eval = eval} httptest::stop_mocking() -unlink(c("ffscrapr-tests-1.4.0","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) ``` From a345bb86fa6b5c1cb5d34a867e44b94f1e91eb8a Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Tue, 13 Apr 2021 11:21:34 -0400 Subject: [PATCH 03/13] v1.4.0.02 - patching mfl_starter_positions, resolves #264 --- DESCRIPTION | 2 +- NEWS.md | 3 ++- R/mfl_starterpositions.R | 16 +++++++++++++--- man/ff_starter_positions.Rd | 2 +- man/{release_questions.Rd => release_bullets.Rd} | 6 +++--- 5 files changed, 20 insertions(+), 9 deletions(-) rename man/{release_questions.Rd => release_bullets.Rd} (71%) diff --git a/DESCRIPTION b/DESCRIPTION index e414e7d5..36ec22f8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.0.01 +Version: 1.4.0.02 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index 9a71328d..e3f75f42 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,8 @@ ## Notes -- Added `release_questions` to help remind me to maintain test infrastructure +- Added `release_questions` to help remind me to maintain test infrastructure (v1.4.0.01) +- `mfl_starter_positions` now correctly calculates offensive starters (first via "iop_starters" if defined and then otherwise by subtracting idp starters) as well as kdst_starters (Resolves #264) (v1.4.0.02) --- diff --git a/R/mfl_starterpositions.R b/R/mfl_starterpositions.R index 59a7f4b4..ba1d0799 100644 --- a/R/mfl_starterpositions.R +++ b/R/mfl_starterpositions.R @@ -9,18 +9,24 @@ #' #' @examples #' \donttest{ -#' dlfidp_conn <- mfl_connect(2020, league_id = 54040) +#' dlfidp_conn <- mfl_connect(2020, league_id = 33158) #' ff_starter_positions(conn = dlfidp_conn) #' } #' #' @export ff_starter_positions.mfl_conn <- function(conn, ...) { + starter_positions <- mfl_getendpoint(conn, "league") %>% purrr::pluck("content", "league", "starters") %>% list() %>% tibble::tibble() %>% - tidyr::hoist(1, "total_starters" = "count", "defense_starters" = "idp_starters", "position") %>% + tidyr::hoist( + 1, + "total_starters" = "count", + "defense_starters" = "idp_starters", + "offense_starters" = "iop_starters", + "position") %>% tidyr::unnest_longer("position") %>% tidyr::hoist("position", "pos" = "name", "limit") %>% tidyr::separate("limit", into = c("min", "max"), sep = "\\-", fill = "right") %>% @@ -28,7 +34,10 @@ ff_starter_positions.mfl_conn <- function(conn, ...) { dplyr::mutate( max = dplyr::coalesce(.data$max, .data$min), defense_starters = dplyr::coalesce(as.integer(.data[["defense_starters"]]), 0), - offense_starters = as.integer(.data$total_starters) - .data$defense_starters + kdst_starters = sum(.data$pos %in% c("DEF","PK","PN","TMPK","TMPN","Coach","ST") * .data$min), + offense_starters = dplyr::coalesce( + as.integer(.data[["offense_starters"]]), + as.integer(.data$total_starters) - .data$defense_starters - .data$kdst_starters) ) %>% dplyr::select( "pos", @@ -36,6 +45,7 @@ ff_starter_positions.mfl_conn <- function(conn, ...) { "max", "offense_starters", "defense_starters", + "kdst_starters", "total_starters" ) diff --git a/man/ff_starter_positions.Rd b/man/ff_starter_positions.Rd index 956ccba8..f117e777 100644 --- a/man/ff_starter_positions.Rd +++ b/man/ff_starter_positions.Rd @@ -54,7 +54,7 @@ ff_starter_positions(conn) } \donttest{ -dlfidp_conn <- mfl_connect(2020, league_id = 54040) +dlfidp_conn <- mfl_connect(2020, league_id = 33158) ff_starter_positions(conn = dlfidp_conn) } diff --git a/man/release_questions.Rd b/man/release_bullets.Rd similarity index 71% rename from man/release_questions.Rd rename to man/release_bullets.Rd index 9344c9c1..0f060659 100644 --- a/man/release_questions.Rd +++ b/man/release_bullets.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/0_helpers.R -\name{release_questions} -\alias{release_questions} +\name{release_bullets} +\alias{release_bullets} \title{Release questions} \usage{ -release_questions() +release_bullets() } \description{ Release questions From b29bc16ae0c4475f512c1fa5c70e12f3ec6d3602 Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Tue, 13 Apr 2021 11:26:10 -0400 Subject: [PATCH 04/13] font fun --- pkgdown/extra.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgdown/extra.css b/pkgdown/extra.css index c1ee8a3b..3325870c 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -10,14 +10,15 @@ h1 { } h1,h2,h3 { + font-family: 'IBM Plex Sans', sans-serif; font-weight: 700; } pre, code { - font-family: 'Fira Mono'; + font-family: 'Fira Mono', monospace; } .navbar-link { font-weight: 700; - font-family: 'Fira Mono'; + font-family: 'Fira Mono', sans-serif; } From 4ef64398398925e77278908262720168fae7c87e Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Tue, 13 Apr 2021 11:35:16 -0400 Subject: [PATCH 05/13] font fun round 2 --- pkgdown/extra.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgdown/extra.css b/pkgdown/extra.css index 3325870c..64a2ddc2 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -7,9 +7,10 @@ body{ h1 { font-family: 'Fira Mono', sans-serif; + font-weight: 700; } -h1,h2,h3 { +h2,h3 { font-family: 'IBM Plex Sans', sans-serif; font-weight: 700; } From b5c759aea2012240b4acb8120c741edfb203059c Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Wed, 14 Apr 2021 08:39:53 -0400 Subject: [PATCH 06/13] update nflfastr downloads, fixes #268 --- DESCRIPTION | 2 +- NEWS.md | 1 + R/1_import_nflfastr.R | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 36ec22f8..e9836296 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.0.02 +Version: 1.4.0.03 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index e3f75f42..980b35ee 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ - Added `release_questions` to help remind me to maintain test infrastructure (v1.4.0.01) - `mfl_starter_positions` now correctly calculates offensive starters (first via "iop_starters" if defined and then otherwise by subtracting idp starters) as well as kdst_starters (Resolves #264) (v1.4.0.02) +- Redirected nflfastr download functions to the new nflverse/ repository locations. (Resolves #268) (v1.4.0.03) --- diff --git a/R/1_import_nflfastr.R b/R/1_import_nflfastr.R index 3d3cb9e7..c69d8623 100644 --- a/R/1_import_nflfastr.R +++ b/R/1_import_nflfastr.R @@ -26,7 +26,7 @@ nflfastr_weekly <- function(type = c("offense", "defense", "all")) { file_name <- match.arg(type) - url_query <- "https://github.com/guga31bb/nflfastR-data/raw/master/data/player_stats.rds" + url_query <- "https://github.com/nflverse/nflfastR-data/raw/master/data/player_stats.rds" response <- httr::RETRY("GET", url_query) @@ -66,7 +66,7 @@ nflfastr_weekly <- function(type = c("offense", "defense", "all")) { nflfastr_rosters <- function(seasons) { checkmate::assert_numeric(seasons, lower = 1999, upper = lubridate::year(Sys.Date())) - urls <- glue::glue("https://github.com/mrcaseb/nflfastR-roster/raw/master/data/seasons/roster_{seasons}.rds") + urls <- glue::glue("https://github.com/nflverse/nflfastR-roster/raw/master/data/seasons/roster_{seasons}.rds") df_rosters <- purrr::map_df(urls, .nflfastr_roster) From d5d4f8cac731063424ac4c642d8ef4c43c72ee8b Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Thu, 15 Apr 2021 09:31:32 -0400 Subject: [PATCH 07/13] fix cran environment location, resolves #269 --- DESCRIPTION | 2 +- NEWS.md | 1 + R/sleeper_draftpicks.R | 5 +++-- R/zzz.R | 36 +++++++++++++++++++++--------------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e9836296..6494053f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.0.03 +Version: 1.4.0.04 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index 980b35ee..36ca0b87 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ - Added `release_questions` to help remind me to maintain test infrastructure (v1.4.0.01) - `mfl_starter_positions` now correctly calculates offensive starters (first via "iop_starters" if defined and then otherwise by subtracting idp starters) as well as kdst_starters (Resolves #264) (v1.4.0.02) - Redirected nflfastr download functions to the new nflverse/ repository locations. (Resolves #268) (v1.4.0.03) +- `.ffscrapr_env` relocated from being a child of the base environment to being a child of the empty environment (Resolves #269) (v1.4.0.04) --- diff --git a/R/sleeper_draftpicks.R b/R/sleeper_draftpicks.R index 49503d7a..10a41e20 100644 --- a/R/sleeper_draftpicks.R +++ b/R/sleeper_draftpicks.R @@ -63,8 +63,9 @@ ff_draftpicks.sleeper_conn <- function(conn, ...) { purrr::pluck("content") draft_rounds <- league_settings %>% - purrr::pluck("settings", "draft_rounds") %>% - seq_len() + purrr::pluck("settings", "draft_rounds") + + draft_rounds <- seq_len(draft_rounds) # Seems to be that you can only trade three years in advance, hard-coded into the platform seasons <- league_settings %>% diff --git a/R/zzz.R b/R/zzz.R index 6ce328da..5b8c8eb5 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,5 +1,7 @@ #### On Load #### +.ffscrapr_env <- new.env(parent = emptyenv()) + .onLoad <- function(libname, pkgname) { # nocov start @@ -89,21 +91,25 @@ # if (memoise_option == "off") packageStartupMessage('Note: ffscrapr.cache is set to "off"') - env <- rlang::env( - user_agent = glue::glue( - "ffscrapr/{utils::packageVersion('ffscrapr')} API client package", - " https://github.com/dynastyprocess/ffscrapr" - ) %>% - httr::user_agent(), - get = ratelimitr::limit_rate(.retry_get, ratelimitr::rate(60, 60)), - get.mfl = ratelimitr::limit_rate(.retry_get, ratelimitr::rate(2, 3)), - get.sleeper = ratelimitr::limit_rate(.retry_get, ratelimitr::rate(30, 2)), - get.flea = ratelimitr::limit_rate(.retry_get, ratelimitr::rate(30, 2)), - get.espn = ratelimitr::limit_rate(.retry_get, ratelimitr::rate(30, 2)), - post = ratelimitr::limit_rate(.retry_post, ratelimitr::rate(60, 60)) - ) - - assign(".ffscrapr_env", env, envir = baseenv()) + user_agent <- glue::glue("ffscrapr/{utils::packageVersion('ffscrapr')} ", + "API client package ", + "https://github.com/dynastyprocess/ffscrapr") %>% + httr::user_agent() + + # get <- ratelimitr::limit_rate(.retry_get, ratelimitr::rate(60, 60)) + get.mfl <- ratelimitr::limit_rate(.retry_get, ratelimitr::rate(2, 3)) + get.sleeper <- ratelimitr::limit_rate(.retry_get, ratelimitr::rate(30, 2)) + get.flea <- ratelimitr::limit_rate(.retry_get, ratelimitr::rate(30, 2)) + get.espn <- ratelimitr::limit_rate(.retry_get, ratelimitr::rate(30, 2)) + post <- ratelimitr::limit_rate(.retry_post, ratelimitr::rate(60, 60)) + + + assign("user_agent",user_agent, envir = .ffscrapr_env) + assign("get.mfl",get.mfl, envir = .ffscrapr_env) + assign("get.sleeper",get.sleeper, envir = .ffscrapr_env) + assign("get.flea",get.flea, envir = .ffscrapr_env) + assign("get.espn",get.espn, envir = .ffscrapr_env) + assign("post",post, envir = .ffscrapr_env) # nocov end } From e7b179161d05ca6a003467a1430bef422b880a0c Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Sat, 17 Apr 2021 21:58:58 -0400 Subject: [PATCH 08/13] refactor scoringhistory, resolves #265 --- DESCRIPTION | 3 +- NEWS.md | 2 + R/0_helpers.R | 13 ++++ R/espn_scoringhistory.R | 8 ++- R/flea_scoringhistory.R | 16 ++--- R/mfl_scoringhistory.R | 30 ++++++--- R/sleeper_scoringhistory.R | 12 ++-- R/sysdata.rda | Bin 1727 -> 1209 bytes data-raw/stat_mapping.csv | 110 ++++++++++++++++++++++++++------- data-raw/usedata_statmapping.R | 6 +- data/nflfastr_stat_mapping.rda | Bin 0 -> 822 bytes 11 files changed, 151 insertions(+), 49 deletions(-) create mode 100644 data/nflfastr_stat_mapping.rda diff --git a/DESCRIPTION b/DESCRIPTION index 6494053f..e7616583 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.0.04 +Version: 1.4.0.05 Authors@R: c(person(given = "Tan", family = "Ho", @@ -56,6 +56,7 @@ Suggests: rmarkdown (>= 2.6), testthat (>= 2.1.0), withr (>= 2.4.0) +LazyData: true VignetteBuilder: knitr Encoding: UTF-8 diff --git a/NEWS.md b/NEWS.md index 36ca0b87..e2f076ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,8 @@ - `mfl_starter_positions` now correctly calculates offensive starters (first via "iop_starters" if defined and then otherwise by subtracting idp starters) as well as kdst_starters (Resolves #264) (v1.4.0.02) - Redirected nflfastr download functions to the new nflverse/ repository locations. (Resolves #268) (v1.4.0.03) - `.ffscrapr_env` relocated from being a child of the base environment to being a child of the empty environment (Resolves #269) (v1.4.0.04) +- `ff_stat_mapping` converted from internal dataframe to exported dataframe. It is a long table of conversions between nflfastr player stats columns to specific fantasy platform columns. +- `ff_scoringhistory` refactored and adds better support for MFL's fumbles and firstdowns. (Resolves #265) (v1.4.0.05) --- diff --git a/R/0_helpers.R b/R/0_helpers.R index 287bb903..13707bea 100644 --- a/R/0_helpers.R +++ b/R/0_helpers.R @@ -163,3 +163,16 @@ release_bullets <- function(){ ) } + +#' Mappings for nflfastr to fantasy platform scoring +#' +#' A small helper dataframe for connecting nflfastr to specific fantasy platform rules. +#' +#' @format A data frame with ~85 rows and 3 variables: +#' \describe{ +#' \item{nflfastr_event}{the column name of the statistic in the nflfastr_weekly dataset} +#' \item{platform}{specific platform that this mapping applies to} +#' \item{ff_event}{name of the statistic for that platform} +#' } +#' @source \url{DynastyProcess.com} +"nflfastr_stat_mappings" diff --git a/R/espn_scoringhistory.R b/R/espn_scoringhistory.R index 9680554e..bd836bf8 100644 --- a/R/espn_scoringhistory.R +++ b/R/espn_scoringhistory.R @@ -20,7 +20,10 @@ ff_scoringhistory.espn_conn <- function(conn, season = 1999:2020, ...) { # Pull in scoring rules for that league league_rules <- - ff_scoring(conn) + ff_scoring(conn) %>% + dplyr::left_join( + nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "espn"), + by = c("stat_name" = "ff_event")) # Use custom ffscrapr function to get positions fron nflfastR rosters fastr_rosters <- @@ -41,8 +44,7 @@ ff_scoringhistory.espn_conn <- function(conn, season = 1999:2020, ...) { "special_teams_tds" ) ) %>% - dplyr::inner_join(stat_mapping, by = c("metric" = "nflfastr_event")) %>% - dplyr::inner_join(league_rules, by = c("espn_event" = "stat_name", "position" = "pos")) %>% + dplyr::inner_join(league_rules, by = c("metric" = "nflfastr_event", "position" = "pos")) %>% dplyr::mutate(points = .data$value * .data$points) %>% dplyr::group_by(.data$season, .data$week, .data$player_id, .data$sportradar_id) %>% dplyr::mutate(points = round(sum(.data$points, na.rm = TRUE), 2)) %>% diff --git a/R/flea_scoringhistory.R b/R/flea_scoringhistory.R index b5202419..16860672 100644 --- a/R/flea_scoringhistory.R +++ b/R/flea_scoringhistory.R @@ -8,10 +8,8 @@ #' #' @examples #' \donttest{ -#' #' -#' conn <- fleaflicker_connect(2020, 312861) -#' x <- ff_scoringhistory(conn, season = 2020) -#' x +#' # conn <- fleaflicker_connect(2020, 312861) +#' ff_scoringhistory(conn, season = 2020) #' } #' #' @describeIn ff_scoringhistory Fleaflicker: returns scoring history in a flat table, one row per player per week. @@ -22,7 +20,12 @@ ff_scoringhistory.flea_conn <- function(conn, season = 1999:2020, ...) { # Pull in scoring rules for that league league_rules <- - ff_scoring(conn) + ff_scoring(conn) %>% + dplyr::left_join( + nflfastr_stat_mapping %>% + dplyr::filter(.data$platform == "fleaflicker") %>% + dplyr::mutate(ff_event = as.integer(.data$ff_event)), + by = c("event_id" = "ff_event")) # Use custom ffscrapr function to get positions fron nflfastR rosters fastr_rosters <- @@ -43,8 +46,7 @@ ff_scoringhistory.flea_conn <- function(conn, season = 1999:2020, ...) { "special_teams_tds" ) ) %>% - dplyr::inner_join(stat_mapping, by = c("metric" = "nflfastr_event")) %>% - dplyr::inner_join(league_rules, by = c("fleaflicker_event" = "event_id", "position" = "pos")) %>% + dplyr::inner_join(league_rules, by = c("metric" = "nflfastr_event", "position" = "pos")) %>% dplyr::mutate(points = .data$value * .data$points) %>% dplyr::group_by(.data$season, .data$week, .data$player_id, .data$sportradar_id) %>% dplyr::mutate(points = round(sum(.data$points, na.rm = TRUE), 2)) %>% diff --git a/R/mfl_scoringhistory.R b/R/mfl_scoringhistory.R index 5ecf26d1..1e900845 100644 --- a/R/mfl_scoringhistory.R +++ b/R/mfl_scoringhistory.R @@ -29,16 +29,31 @@ ff_scoringhistory.mfl_conn <- function(conn, season = 1999:2020, ...) { dplyr::mutate(dplyr::across( .cols = c("lower_range", "upper_range"), .fns = as.numeric - )) + )) %>% + dplyr::left_join( + nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "mfl"), + by = c("event" = "ff_event")) %>% + dplyr::select( + "pos","points","lower_range","upper_range","event", "nflfastr_event", "short_desc" + ) - # Use custom ffscrapr function to get positions fron nflfastR rosters + # Use custom ffscrapr function to get positions from nflfastR rosters fastr_rosters <- nflfastr_rosters(season) %>% dplyr::mutate(position = dplyr::if_else(.data$position %in% c("HB", "FB"), "RB", .data$position)) # Load stats from nflfastr and map the rules from the internal stat_mapping file - nflfastr_weekly() %>% + fastr_weekly <- nflfastr_weekly() %>% dplyr::inner_join(fastr_rosters, by = c("player_id" = "gsis_id", "season" = "season")) %>% + dplyr::select( + "season", "player_id", "sportradar_id", "position", "full_name","recent_team","week", + "completions", "attempts", "passing_yards", "passing_tds", "interceptions", "sacks", + "sack_fumbles_lost", "passing_first_downs", "passing_2pt_conversions", "carries", + "rushing_yards", "rushing_tds", "rushing_fumbles_lost", "rushing_first_downs", + "rushing_2pt_conversions", "receptions", "targets", "receiving_yards", "receiving_tds", + "receiving_fumbles_lost", "receiving_first_downs", "receiving_2pt_conversions", + "special_teams_tds", "sack_yards", "rushing_fumbles", "receiving_fumbles", "sack_fumbles" + ) %>% tidyr::pivot_longer( names_to = "metric", cols = c( @@ -47,18 +62,17 @@ ff_scoringhistory.mfl_conn <- function(conn, season = 1999:2020, ...) { "rushing_yards", "rushing_tds", "rushing_fumbles_lost", "rushing_first_downs", "rushing_2pt_conversions", "receptions", "targets", "receiving_yards", "receiving_tds", "receiving_fumbles_lost", "receiving_first_downs", "receiving_2pt_conversions", - "special_teams_tds" + "special_teams_tds", "sack_yards", "rushing_fumbles", "receiving_fumbles", "sack_fumbles" ) ) %>% - dplyr::inner_join(stat_mapping, by = c("metric" = "nflfastr_event")) %>% - dplyr::inner_join(league_rules, by = c("mfl_event" = "event", "position" = "pos")) %>% + dplyr::inner_join(league_rules, by = c("metric" = "nflfastr_event", "position" = "pos")) %>% dplyr::filter(.data$value >= .data$lower_range, .data$value <= .data$upper_range) %>% dplyr::mutate(points = .data$value * .data$points) %>% dplyr::group_by(.data$season, .data$week, .data$player_id, .data$sportradar_id) %>% dplyr::mutate(points = round(sum(.data$points, na.rm = TRUE), 2)) %>% dplyr::ungroup() %>% dplyr::select("season", "week", - "gsis_id" = "player_id", "sportradar_id", "player_name", "pos" = "position", + "gsis_id" = "player_id", "sportradar_id", "player_name"="full_name", "pos" = "position", "team" = "recent_team", "metric", "value", "points" ) %>% tidyr::pivot_wider( @@ -68,4 +82,6 @@ ff_scoringhistory.mfl_conn <- function(conn, season = 1999:2020, ...) { values_fill = 0, values_fn = max ) + + return(fastr_weekly) } diff --git a/R/sleeper_scoringhistory.R b/R/sleeper_scoringhistory.R index 73f9a496..3b47c0b9 100644 --- a/R/sleeper_scoringhistory.R +++ b/R/sleeper_scoringhistory.R @@ -9,8 +9,8 @@ #' @examples #' \donttest{ #' #' -#' conn <- ff_connect(platform = "sleeper", league_id = "522458773317046272", season = 2020) -#' ff_scoringhistory(conn, season = 2020) +#' # conn <- ff_connect(platform = "sleeper", league_id = "522458773317046272", season = 2020) +#' # ff_scoringhistory(conn, season = 2020) #' } #' #' @describeIn ff_scoringhistory Sleeper: returns scoring history in a flat table, one row per player per week. @@ -21,7 +21,10 @@ ff_scoringhistory.sleeper_conn <- function(conn, season = 1999:2020, ...) { # Pull in scoring rules for that league league_rules <- - ff_scoring(conn) + ff_scoring(conn) %>% + dplyr::left_join( + nflfastr_stat_mapping %>% dplyr::filter(.data$platform == "sleeper"), + by = c("event" = "ff_event")) # Use custom ffscrapr function to get positions fron nflfastR rosters fastr_rosters <- @@ -42,8 +45,7 @@ ff_scoringhistory.sleeper_conn <- function(conn, season = 1999:2020, ...) { "special_teams_tds" ) ) %>% - dplyr::inner_join(stat_mapping, by = c("metric" = "nflfastr_event")) %>% - dplyr::inner_join(league_rules, by = c("sleeper_event" = "event", "position" = "pos")) %>% + dplyr::inner_join(league_rules, by = c("metric" = "nflfastr_event", "position" = "pos")) %>% dplyr::mutate(points = .data$value * .data$points) %>% dplyr::group_by(.data$season, .data$week, .data$player_id, .data$sportradar_id) %>% dplyr::mutate(points = round(sum(.data$points, na.rm = TRUE), 2)) %>% diff --git a/R/sysdata.rda b/R/sysdata.rda index 9c8969ed1e596b8646336e93460fb3fe9e7188d8..a0d202fbe61432542457301d971362abb0b134da 100644 GIT binary patch literal 1209 zcmV;q1V;NpT4*^jL0KkKS?+V}egF}jf5QL&?f?K0f8ZAkG{C>_|KLCX0RR92;0Atp zUjrbv0c0B0qHJ?UOiTbwMg(br1|tN?fJPkAlM?_F5rGM(#9&64 z5MnS)m;_*jDor8j4GjU1X^=3005s45B9s6nJv~#vG^UN}fB?|MX!49k)CENZhLJRA zr>N6F8b4If28M$ZY5+(Tq6dcCDv8^hxZr?mTrT;$ z@7s=QI8(2v?~}@%>AyUAXydG!%MS_Tn9q4Of1Eykj~)*mv8rdZocZP3yf~*$%=Yy= zFD^E9>yE}Nwd;Eqc>X_L4?26acFEF~mYy~`_+h7iJfF&%`~U^rL{VWC2qh6sxIh#R zPlf_1xhdo2+SRWG-N+;i2o6|JmWuc987YG%OqD5abMN80QpX%gD~Trc8Q~elj0+Va zi4K(s(xErTA)Brv8P*ZICT^{J^StQct>D(w)L_YzCO1r*(X_^~t$i{*5iC!t zAijwO^F;F`R80S5gFvSMDcM8}5z?xhqJatrS_K21Z3n42lN8*h$O+|7Jd*%NlS~B) z%S|;ZV9()?wT{8P(w_tI-$>>EC8^BBg_-FYG+XK$TB5CxY3@ZGj5gyEVMqqr+2diZ{o;PiWj1j)GvYRL#kAbFr$2LI=`QTEXKqI4%Hep95LvfLtK5P>G4kS0hGtzDO5 zJg^~ZBWgJj=ps6_1J6j^fH+Xv2u731V4KLM3euYr0|b;z6PYDR5)xrA$;3|_qmTBM0z``EkH{};M1~LFS0yQV#P;j)hNFtVTh?FwY037QW8y+lLXj1 zeaH^LLqfaxL{StL0+^fVjtc9q*5>9qz_0fa?Qa39CKD1?Q4CqMZGm*az{jfDJw5KY zwS&eK$B|4JE}7F>xUo>lMT(DFJNv!dq=qlDy|lJMz$jN8D5a>3fUTE+(_&hZAf}u+ XmvdP-J;yKlulT!?DZ+$@bDv}I)!ixT literal 1727 zcmV;w20-~jT4*^jL0KkKSw$+@7622Z|HJ?P@8}3Uf8f8ZeBi(D|KLsl0RR9X00H0# ze?GKO01Z$83IeiF5Rposq@IzcnhgLM8V9HV02%-Q00xHxL8e1Z8W=#xXkd*EGHB2Y zgAf2391RAU4K!$B10kV;G&IShKr#$K0BCSD8e}xlp@a;Eh6vEpCXE2dF#rLeijruJ z22C1dXvv^ypfvRW0000003t|4#7u%RM%2LxiIIo_>NGR~p{9@2^ri`-9pQJL7eeTP z)58~T$f&8vwJ3&=`l~zL1WoW%U!(5*mKCcL`B%f0xv~)tu4qKv)r!S>|8_E|Iy8$OiipVjD>|CfgeuZLzTI zT&lj+X~GstbX1?dq=c1Km48p?pp3r{moqdb>Z)mKNXb%4B$7f^Rc@leB(y22w$?-q za=IW}5fDFCR&#+NAtaInWFaNvAVHQbI(_}ap{1LEuLI6PK%(_;A`P0U%rXg@YHyp?%4Apb|7`&nYZx3@sC4 z)EidoCy#xDdR#Tg+QH3`Rp3rl!|d?YwV^T~Slz@nxN?EC40P8j-GI+U%EcFWSuuT= zmSOc+`LsE=8-trvwkR)cmUP(DWHN!Cg|y;mO-!&Gxw1697}PHh%e7)`6FUC)@33`1 z@ZdGDZh;_39Aa<{(skmj5GX7b3j`PvTHSdV zfdVF3D-4yz(%A`Wi9kexlE5a;RqlQNZO@PvnWtHXVRxmV~lDg zgwIPVSb$5EnlVNJJADu`R@vvdAW&Q1PZekZ>dPn)C?{pD!T8f;-JaRNfkEom1VqUy z`2-1&XcGcd4e2w^DKpI=TG^)h_mcu2kS4GoNIJ9u#eq%i_H#DXG6|SelOQuB;>rRN zKMjwFG8>T~M7neu2PH24Jt$0O(3DfQNEd)b*(8AjOzy*JTk=8OArdPE3 zH4I*{dsJJP3anoEwgQ5Jt46cjCP+fpb6n!tF__&gd!Y?w?vNtL5FlVpM98EKzxUw~ z+;K0N_db_Rc=1(DLzX-xkUoANSYX~baozN*-29?adW3>>3DS{Jd!ig9pI}c}DIipV0#!*;q7?vuRH&jwed6K2{T&hYL#x%0c>+99 zO?D1~rACTZu;vSR$$=I3r)|#F4`B?x(d;Y~nR(_54#ww%d^-tVjvTyDIPz1Jj3T+l zAy6QtsB+*)nCTL=M8ZrYtd*6bmklgmHy^a-1DQ?lhC{Ix1kRaI40B~?{b-iSLuJG}YALI+FOplBVacopy@ zbWZIMZRK0UC3T0r0&Pehz5ToM84pd0OoTkB=pokg2zw!_=n_zk0FX=+Ift6zgn~Q3 zH0R6T@n_}e_S4A}bOSOHM?%0!BqAP}br+I83-o78Qi>y~DSGyf)+ukKu{>>`;;z=+L`V*yEk>xmP>TdEp1 z%yqOUtcmEEtBT1qn_x7X9K`69g>Z`?PgyvL1|$<oPF0XG6YV6f% dplyr::select(-"points") -usethis::use_data(sleeper_rule_mapping, stat_mapping, overwrite = TRUE, internal = TRUE) +usethis::use_data(nflfastr_stat_mapping, overwrite = TRUE) + +usethis::use_data(sleeper_rule_mapping, overwrite = TRUE, internal = TRUE) diff --git a/data/nflfastr_stat_mapping.rda b/data/nflfastr_stat_mapping.rda new file mode 100644 index 0000000000000000000000000000000000000000..8913ffa0f4688890b842c5b88e15e1ad8a6cbac8 GIT binary patch literal 822 zcmV-61IheCT4*^jL0KkKS^4!ozW@Y|f6)K`@1RHlKY%T*-eAA)-=IJM00;m9&;y=P zwgaFjh}4-(jEq3g82|tPJwre;02S&B100a>zgwP6~rb(v%-*+-~)o}f0Tsisd% zHANq)VhnIV&ADw*OW>&d;-qQws)J+ew{AsK!XTbs*M(I<+=`(zZ1?Q(?d+XTUtS8( z#C4EQmR*KQLWx^Ss8LkJCD|qSG-sg%1o!3;7Rr$lIto#Qz=?v+>Emm5N##CM=`oj% zGz^qm0tQ&L2pb}_AeDi10p?T=Wk3ib1PF+8K|mAZ%RmIf086c`K3=-_?Fj}gu#$wS z7&1HnB+uwcvJQeNn8!Kf32Hz{Od(Kp1ab|83de2+B8Vsn2v~`bbDXi7H+Bl_EeDkj zhK9TDIOgr|M=#Q#${N6TIxBUz1MP$$5V6?7FPGn2?7juy`@#c;+bz0?ej*-0hfz?; zv^t-%+wOmG{2#0F0;merPWwfieet_Z?_6TsA#54Nf za4Tq_Ztz*1NO$Q9qw-*PC-D#UdTcc5s`!>2t+YfcTg&> zyrooj6p>9l0v&;$paYkc>7MEuJv}`AL(Dk?+8p8aig9JkSg#-Mt-@G96Wn_!mVk3^ zdO7o)yF+v}bcT@H9f6mC=jq|F+*h0(W|uZ@9U-JM@dprY22L5rz(JwbQUr);BmzL9 zMv>M?4n_$;Aw)C^2}w|4#uM$$oH6V-k!}RmuAxhV61&K{#4QIIQ#I#2grAm@9ek|TaZTTCkOz(lwMXag7a5exiX$rRy2L+8}`{Ax>P ANdN!< literal 0 HcmV?d00001 From fc5d9e31d5748ac972ac9e810d68e3008297b613 Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Sat, 17 Apr 2021 22:26:15 -0400 Subject: [PATCH 09/13] begin process of cran release --- DESCRIPTION | 2 +- NEWS.md | 21 +++++++++++++-------- R/0_helpers.R | 2 +- README.Rmd | 12 ++++++------ README.md | 6 +++--- man/ff_scoringhistory.Rd | 10 ++++------ man/nflfastr_stat_mapping.Rd | 24 ++++++++++++++++++++++++ tests/testthat/setup.R | 6 +++--- tests/testthat/test-ff_scoringhistory.R | 4 ++-- vignettes/espn_basics.Rmd | 6 +++--- vignettes/espn_getendpoint.Rmd | 6 +++--- vignettes/ffscrapr_scoringhistory.Rmd | 4 ++-- vignettes/fleaflicker_basics.Rmd | 6 +++--- vignettes/fleaflicker_getendpoint.Rmd | 6 +++--- vignettes/mfl_basics.Rmd | 6 +++--- vignettes/mfl_getendpoint.Rmd | 6 +++--- vignettes/sleeper_basics.Rmd | 6 +++--- vignettes/sleeper_getendpoint.Rmd | 6 +++--- 18 files changed, 83 insertions(+), 56 deletions(-) create mode 100644 man/nflfastr_stat_mapping.Rd diff --git a/DESCRIPTION b/DESCRIPTION index e7616583..4154f5f4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ffscrapr Title: API Client for Fantasy Football League Platforms -Version: 1.4.0.05 +Version: 1.4.1 Authors@R: c(person(given = "Tan", family = "Ho", diff --git a/NEWS.md b/NEWS.md index e2f076ad..8539c4e6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,13 +1,18 @@ -# ffscrapr (development version) +# ffscrapr 1.4.1 -## Notes +The main goal of v1.4.1 is to patch some issues raised by CRAN checks and also correct some bugs in the new experimental `ff_scoringhistory` and `ff_starter_positions` functions released in v1.4.0. -- Added `release_questions` to help remind me to maintain test infrastructure (v1.4.0.01) -- `mfl_starter_positions` now correctly calculates offensive starters (first via "iop_starters" if defined and then otherwise by subtracting idp starters) as well as kdst_starters (Resolves #264) (v1.4.0.02) -- Redirected nflfastr download functions to the new nflverse/ repository locations. (Resolves #268) (v1.4.0.03) -- `.ffscrapr_env` relocated from being a child of the base environment to being a child of the empty environment (Resolves #269) (v1.4.0.04) -- `ff_stat_mapping` converted from internal dataframe to exported dataframe. It is a long table of conversions between nflfastr player stats columns to specific fantasy platform columns. -- `ff_scoringhistory` refactored and adds better support for MFL's fumbles and firstdowns. (Resolves #265) (v1.4.0.05) +## New features + +- `nflfastr_stat_mapping` is a dataframe that maps nflfastr columns to fantasy scoring rules, and is now exported for end-user usage. It is primarily used inside of `ff_scoringhistory()`. + +## Minor changes + +- Added `release_questions` to help remind me to maintain test infrastructure +- `mfl_starter_positions` now correctly calculates offensive starters (first via "iop_starters" if defined and then otherwise by subtracting idp starters) as well as kdst_starters (Resolves #264) +- Redirected nflfastr download functions to the new nflverse/ repository locations. (Resolves #268) +- `.ffscrapr_env` relocated from being a child of the base environment to being a child of the empty environment (Resolves #269) +- `ff_scoringhistory` refactored and adds better support for MFL's fumbles and firstdowns. (Resolves #265) --- diff --git a/R/0_helpers.R b/R/0_helpers.R index 13707bea..c254efda 100644 --- a/R/0_helpers.R +++ b/R/0_helpers.R @@ -175,4 +175,4 @@ release_bullets <- function(){ #' \item{ff_event}{name of the statistic for that platform} #' } #' @source \url{DynastyProcess.com} -"nflfastr_stat_mappings" +"nflfastr_stat_mapping" diff --git a/README.Rmd b/README.Rmd index cb3c3b50..eb402ba6 100644 --- a/README.Rmd +++ b/README.Rmd @@ -23,17 +23,17 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) httptest::use_mock_api() ``` -# ffscrapr +# ffscrapr *An R Client for Fantasy Football League APIs* @@ -47,13 +47,13 @@ Helps access various Fantasy Football APIs (currently MFL, Sleeper, Fleaflicker, ### Installation -Version 1.4.0 is now on CRAN :tada: and can be installed with: +Version 1.4.1 is now on CRAN :tada: and can be installed with: ```{r eval = FALSE} install.packages("ffscrapr") # or from GitHub release with the remotes package via: # install.packages("remotes") -remotes::install_github("dynastyprocess/ffscrapr", ref = "v1.4.0") +remotes::install_github("dynastyprocess/ffscrapr", ref = "v1.4.1") ``` Install the development version from GitHub with: @@ -109,5 +109,5 @@ The APIs and data accessed by this package belong to their respective owners, an ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/README.md b/README.md index 43b84d80..c155bde4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# ffscrapr +# ffscrapr *An R Client for Fantasy Football League APIs* @@ -30,13 +30,13 @@ other data sources. ### Installation -Version 1.4.0 is now on CRAN :tada: and can be installed with: +Version 1.4.1 is now on CRAN :tada: and can be installed with: ``` r install.packages("ffscrapr") # or from GitHub release with the remotes package via: # install.packages("remotes") -remotes::install_github("dynastyprocess/ffscrapr", ref = "v1.4.0") +remotes::install_github("dynastyprocess/ffscrapr", ref = "v1.4.1") ``` Install the development version from GitHub with: diff --git a/man/ff_scoringhistory.Rd b/man/ff_scoringhistory.Rd index f61d7a27..a7f31bc7 100644 --- a/man/ff_scoringhistory.Rd +++ b/man/ff_scoringhistory.Rd @@ -51,10 +51,8 @@ ff_scoringhistory(conn) } \donttest{ -#' -conn <- fleaflicker_connect(2020, 312861) -x <- ff_scoringhistory(conn, season = 2020) -x +# conn <- fleaflicker_connect(2020, 312861) +ff_scoringhistory(conn, season = 2020) } \donttest{ @@ -64,8 +62,8 @@ x \donttest{ #' -conn <- ff_connect(platform = "sleeper", league_id = "522458773317046272", season = 2020) -ff_scoringhistory(conn, season = 2020) +# conn <- ff_connect(platform = "sleeper", league_id = "522458773317046272", season = 2020) +# ff_scoringhistory(conn, season = 2020) } } diff --git a/man/nflfastr_stat_mapping.Rd b/man/nflfastr_stat_mapping.Rd new file mode 100644 index 00000000..8a4ebc26 --- /dev/null +++ b/man/nflfastr_stat_mapping.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/0_helpers.R +\docType{data} +\name{nflfastr_stat_mapping} +\alias{nflfastr_stat_mapping} +\title{Mappings for nflfastr to fantasy platform scoring} +\format{ +A data frame with ~85 rows and 3 variables: +\describe{ + \item{nflfastr_event}{the column name of the statistic in the nflfastr_weekly dataset} + \item{platform}{specific platform that this mapping applies to} + \item{ff_event}{name of the statistic for that platform} +} +} +\source{ +\url{DynastyProcess.com} +} +\usage{ +nflfastr_stat_mapping +} +\description{ +A small helper dataframe for connecting nflfastr to specific fantasy platform rules. +} +\keyword{datasets} diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 6c31d7ec..6ca2cea4 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -15,13 +15,13 @@ skip <- FALSE if (download_mock) { tryCatch( expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip", "f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip", "f.zip") unzip("f.zip", exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main") + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1") withr::defer( - unlink(c("ffscrapr-tests-main", "f.zip"), recursive = TRUE, force = TRUE), + unlink(c("ffscrapr-tests-1.4.1", "f.zip"), recursive = TRUE, force = TRUE), testthat::teardown_env() ) }, diff --git a/tests/testthat/test-ff_scoringhistory.R b/tests/testthat/test-ff_scoringhistory.R index 2aae334c..51e45b1a 100644 --- a/tests/testthat/test-ff_scoringhistory.R +++ b/tests/testthat/test-ff_scoringhistory.R @@ -4,9 +4,9 @@ with_mock_api({ if (!identical(Sys.getenv("MOCK_BYPASS"), "true")) { testthat::local_mock( - nflfastr_weekly = function() readRDS("ffscrapr-tests-main/gh_nflfastr/player_stats.rds"), + nflfastr_weekly = function() readRDS("ffscrapr-tests-1.4.1/gh_nflfastr/player_stats.rds"), nflfastr_rosters = function(seasons) { - purrr::map_df(seasons, ~ readRDS(glue::glue("ffscrapr-tests-main/gh_nflfastr/roster_{.x}.rds"))) + purrr::map_df(seasons, ~ readRDS(glue::glue("ffscrapr-tests-1.4.1/gh_nflfastr/roster_{.x}.rds"))) } ) } diff --git a/vignettes/espn_basics.Rmd b/vignettes/espn_basics.Rmd index e38ba0a7..22718e4d 100644 --- a/vignettes/espn_basics.Rmd +++ b/vignettes/espn_basics.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -158,6 +158,6 @@ In this vignette, I've used only a few functions: ff_connect, ff_league, ff_rost ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/espn_getendpoint.Rmd b/vignettes/espn_getendpoint.Rmd index febca384..a3ae24c1 100644 --- a/vignettes/espn_getendpoint.Rmd +++ b/vignettes/espn_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -153,5 +153,5 @@ Many of the API endpoints are being researched in other languages and you might ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/ffscrapr_scoringhistory.Rmd b/vignettes/ffscrapr_scoringhistory.Rmd index 61bd300b..9326281f 100644 --- a/vignettes/ffscrapr_scoringhistory.Rmd +++ b/vignettes/ffscrapr_scoringhistory.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) diff --git a/vignettes/fleaflicker_basics.Rmd b/vignettes/fleaflicker_basics.Rmd index 67c019d9..11a1b98c 100644 --- a/vignettes/fleaflicker_basics.Rmd +++ b/vignettes/fleaflicker_basics.Rmd @@ -21,10 +21,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -160,6 +160,6 @@ In this vignette, I've used only a few functions: ff_connect, ff_league, ff_rost ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/fleaflicker_getendpoint.Rmd b/vignettes/fleaflicker_getendpoint.Rmd index 7a7a4e46..edf69e94 100644 --- a/vignettes/fleaflicker_getendpoint.Rmd +++ b/vignettes/fleaflicker_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -121,6 +121,6 @@ From here, you can keep unravelling - including the "viewingActualPoints" and "v ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/mfl_basics.Rmd b/vignettes/mfl_basics.Rmd index 7b024613..d95e3b88 100644 --- a/vignettes/mfl_basics.Rmd +++ b/vignettes/mfl_basics.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -155,6 +155,6 @@ Now that you've gotten this far, why not check out some of the other possibiliti ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/mfl_getendpoint.Rmd b/vignettes/mfl_getendpoint.Rmd index e3ff61f5..31137a00 100644 --- a/vignettes/mfl_getendpoint.Rmd +++ b/vignettes/mfl_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -103,5 +103,5 @@ head(fog_tradebait) ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/sleeper_basics.Rmd b/vignettes/sleeper_basics.Rmd index 375876a6..4acea36e 100644 --- a/vignettes/sleeper_basics.Rmd +++ b/vignettes/sleeper_basics.Rmd @@ -21,10 +21,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -165,6 +165,6 @@ In this vignette, I've used ~three functions: ff_connect, ff_league, and ff_rost ```{r include = FALSE} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` diff --git a/vignettes/sleeper_getendpoint.Rmd b/vignettes/sleeper_getendpoint.Rmd index 1ea4504a..9fd04b2f 100644 --- a/vignettes/sleeper_getendpoint.Rmd +++ b/vignettes/sleeper_getendpoint.Rmd @@ -20,10 +20,10 @@ eval <- TRUE tryCatch(expr = { - download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip") + download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/1.4.1.zip","f.zip") unzip('f.zip', exdir = ".") - httptest::.mockPaths(new = "ffscrapr-tests-main")}, + httptest::.mockPaths(new = "ffscrapr-tests-1.4.1")}, warning = function(e) eval <<- FALSE, error = function(e) eval <<- FALSE) @@ -93,6 +93,6 @@ There - this means something to us now! As of this writing (2020-11-10), Kalen B ```{r include = FALSE, eval = eval} httptest::stop_mocking() -unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE) +unlink(c("ffscrapr-tests-1.4.1","f.zip"), recursive = TRUE, force = TRUE) ``` From ed709ff4eba0d67a00b28c82d49b4a50462ec929 Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Sat, 17 Apr 2021 22:42:23 -0400 Subject: [PATCH 10/13] fix news URLs, update cran-comments --- NEWS.md | 4 ++-- cran-comments.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index 36ca0b87..3033457b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,8 +14,8 @@ The main goal of v1.4.0 is to add preliminary support for connecting ffscrapr to nflfastR weekly data, and to clean up bugs from v1.3.0. Huge thanks goes to [Joe Sydlowski](https://twitter.com/JoeSydlowskiFF) for his contributions on scoring history (and everything else DynastyProcess!) ## New Features -- `nflfastr_weekly()` imports weekly offensive statistics from nflfastR's [data repository](https://github.com/guga31bb/nflfastR-data). -- `nflfastr_rosters()` imports team rosters from nflfastR's [roster repository](https://github.com/mrcaseb/nflfastR-roster). +- `nflfastr_weekly()` imports weekly offensive statistics from nflfastR's [data repository](https://github.com/nflverse/nflfastR-data). +- `nflfastr_rosters()` imports team rosters from nflfastR's [roster repository](https://github.com/nflverse/nflfastR-roster). - `ff_scoringhistory()` connects your league's scoring settings to the nflfastr data (c/o the functions above), and allows you to reconstruct historical scoring for your league! - `ff_starter_positions()` describes the starter rules for each player/position, including min and max starters at each position accounting for flex spots. This should be useful for calculating things like value over replacement! diff --git a/cran-comments.md b/cran-comments.md index 1b30399c..2add3bff 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,16 +2,16 @@ ## CRAN Check Corrections -This release corrects a CRAN check issue where a dependency changed from using digest to cachem as an underlying package. ffscrapr has been rewritten to use cachem as per memoise's suggestions on best practice. +This release corrects a CRAN check issue where a new binding was created in the base environment - this environment binding is now being created inside the empty environment. ## New features -This release adds functions to connect to another source of data. +This release also patches some bugs. ## Test environments -* local (Windows) R installation, R 4.0.4 -* ubuntu 20.04 (on GitHub Actions), R 4.0.4 -* MacOS (on GitHub Actions), R 4.0.4 +* local (Windows) R installation, R 4.0.5 +* ubuntu 20.04 (on GitHub Actions), R 4.0.5 +* MacOS (on GitHub Actions), R 4.0.5 * win-builder (devel) ## R CMD check results From 1a07386c006468dd3fc55e24ee48868baf63bef3 Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Sun, 18 Apr 2021 11:18:10 -0400 Subject: [PATCH 11/13] patch whitespace --- data/nflfastr_stat_mapping.rda | Bin 822 -> 814 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/data/nflfastr_stat_mapping.rda b/data/nflfastr_stat_mapping.rda index 8913ffa0f4688890b842c5b88e15e1ad8a6cbac8..6cf8ada47a8059d92b967716e5377dd2536ee5eb 100644 GIT binary patch literal 814 zcmV+}1JV3KT4*^jL0KkKSxRef)&K;J|Iq*c@1O_)KY%T*-eAA)-=IJM00;m9&;y?B zj@am+D2UXVOiYYG&=~*#0D6XiWB@DFh<>ER02vx+8UdlEjT#0+AQ(tgqiPI?s2VhA z0imD(1JnQ-4l-oZOeRJ^z>G~8BM3BUfB^(bAvDk`dFpC5jSUE%Ns*zZfY8$>Gb$+k zQvl5b4Lo+$1ilK7#wtdi8mKlq@L;l%MQs8;ylbH(fn~Ik2UYFs-yGaeeP6##5X5zm zP!?T=N5<5y!gvg1K$K_*gY4o27^OzT|2pOoh z1arlpK<s642XdfpQ~-h?K!}FuC<1%>r~sK@31uPh-^;Sr)r*WvOq3%Ahkyji zFcM7zp(!I6=Q<%ZI+7EJRuFT2FB9#*Ec!>}#OI5(+GKhN>hTR%WO%|1Sb5I-we1aQIf*QBvaw}+{ zYw1m40AObj&B8OS=h8PLaS$LyB#I{3Fo6OA0)dy_6m$>?86X&giVk!i2-H`IDVm}g z1vm&)s3r>H>FR3)GQHxsc})d@`sPDivJixXWMK&c5ezFmv5A$hK_TyyKRRWy@2d7bm`lOVj8*wpg6-m+0)KNls!dYw%Y-)YDUeXfRsRO z0~%3-3^Y&-IzoCh>J6ReDlNdA%Ig%kFjtiqm_pEV6*S&DtB#|5QqS|Fwp#@3<90Rxeuw(xhaz!{$kVB100a>zgwP6~rb(v%-*+-~)o}f0Tsisd% zHANq)VhnIV&ADw*OW>&d;-qQws)J+ew{AsK!XTbs*M(I<+=`(zZ1?Q(?d+XTUtS8( z#C4EQmR*KQLWx^Ss8LkJCD|qSG-sg%1o!3;7Rr$lIto#Qz=?v+>Emm5N##CM=`oj% zGz^qm0tQ&L2pb}_AeDi10p?T=Wk3ib1PF+8K|mAZ%RmIf086c`K3=-_?Fj}gu#$wS z7&1HnB+uwcvJQeNn8!Kf32Hz{Od(Kp1ab|83de2+B8Vsn2v~`bbDXi7H+Bl_EeDkj zhK9TDIOgr|M=#Q#${N6TIxBUz1MP$$5V6?7FPGn2?7juy`@#c;+bz0?ej*-0hfz?; zv^t-%+wOmG{2#0F0;merPWwfieet_Z?_6TsA#54Nf za4Tq_Ztz*1NO$Q9qw-*PC-D#UdTcc5s`!>2t+YfcTg&> zyrooj6p>9l0v&;$paYkc>7MEuJv}`AL(Dk?+8p8aig9JkSg#-Mt-@G96Wn_!mVk3^ zdO7o)yF+v}bcT@H9f6mC=jq|F+*h0(W|uZ@9U-JM@dprY22L5rz(JwbQUr);BmzL9 zMv>M?4n_$;Aw)C^2}w|4#uM$$oH6V-k!}RmuAxhV61&K{#4QIIQ#I#2grAm@9ek|TaZTTCkOz(lwMXag7a5exiX$rRy2L+8}`{Ax>P ANdN!< From e030d383f85c6f805253219b159c0a54b4fc7efa Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Sun, 18 Apr 2021 11:19:19 -0400 Subject: [PATCH 12/13] update docs --- R/0_helpers.R | 6 +++++- data-raw/stat_mapping.csv | 2 +- man/nflfastr_stat_mapping.Rd | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/R/0_helpers.R b/R/0_helpers.R index c254efda..7845877b 100644 --- a/R/0_helpers.R +++ b/R/0_helpers.R @@ -157,11 +157,15 @@ set_unescaped_cookies <- function(...) { #' release_bullets <- function(){ + #nocov start + c( "Tag the current version of ffscrapr-tests as a release version", 'Switch all vignettes and tests to use "ffscrapr-tests-v1.x.x" and download "archive/v1.x.x"' ) + #nocov end + } #' Mappings for nflfastr to fantasy platform scoring @@ -174,5 +178,5 @@ release_bullets <- function(){ #' \item{platform}{specific platform that this mapping applies to} #' \item{ff_event}{name of the statistic for that platform} #' } -#' @source \url{DynastyProcess.com} +#' @source Manually created for ffscrapr by Joe & Tan "nflfastr_stat_mapping" diff --git a/data-raw/stat_mapping.csv b/data-raw/stat_mapping.csv index 2546d879..c5f1abd4 100644 --- a/data-raw/stat_mapping.csv +++ b/data-raw/stat_mapping.csv @@ -61,7 +61,7 @@ sack_fumbles_lost,mfl,FL sacks,mfl,TSK special_teams_tds,mfl,#KT targets,mfl,TGT -sack_yards ,mfl,TSY +sack_yards,mfl,TSY attempts,sleeper,pass_att carries,sleeper,rush_att completions,sleeper,pass_cmp diff --git a/man/nflfastr_stat_mapping.Rd b/man/nflfastr_stat_mapping.Rd index 8a4ebc26..a75d1974 100644 --- a/man/nflfastr_stat_mapping.Rd +++ b/man/nflfastr_stat_mapping.Rd @@ -13,7 +13,7 @@ A data frame with ~85 rows and 3 variables: } } \source{ -\url{DynastyProcess.com} +Manually created for ffscrapr by Joe & Tan } \usage{ nflfastr_stat_mapping From 19616b45507e4d50164709762d70280e3f257f88 Mon Sep 17 00:00:00 2001 From: Tan-DeskPC Date: Sun, 18 Apr 2021 20:22:23 -0400 Subject: [PATCH 13/13] remove sourcing of internaldf --- R/0_helpers.R | 2 +- cran-comments.md | 4 +++- man/nflfastr_stat_mapping.Rd | 3 --- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/R/0_helpers.R b/R/0_helpers.R index 7845877b..cc4843c6 100644 --- a/R/0_helpers.R +++ b/R/0_helpers.R @@ -178,5 +178,5 @@ release_bullets <- function(){ #' \item{platform}{specific platform that this mapping applies to} #' \item{ff_event}{name of the statistic for that platform} #' } -#' @source Manually created for ffscrapr by Joe & Tan +#' "nflfastr_stat_mapping" diff --git a/cran-comments.md b/cran-comments.md index 2add3bff..65b9df38 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,4 +1,6 @@ -## SUBMISSION +## RESUBMISSION + +Corrected url issue in man/nflfastr_stat_mapping.Rd ## CRAN Check Corrections diff --git a/man/nflfastr_stat_mapping.Rd b/man/nflfastr_stat_mapping.Rd index a75d1974..65343143 100644 --- a/man/nflfastr_stat_mapping.Rd +++ b/man/nflfastr_stat_mapping.Rd @@ -12,9 +12,6 @@ A data frame with ~85 rows and 3 variables: \item{ff_event}{name of the statistic for that platform} } } -\source{ -Manually created for ffscrapr by Joe & Tan -} \usage{ nflfastr_stat_mapping }