From e630775e9ed072c7fb1552d264c662cec0683e94 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Feb 2022 14:56:11 -0800 Subject: [PATCH 1/6] import print_step instead of printer --- NAMESPACE | 2 +- R/0_imports.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 3fae4d2..155c948 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -75,7 +75,7 @@ importFrom(recipes,bake) importFrom(recipes,check_type) importFrom(recipes,is_trained) importFrom(recipes,prep) -importFrom(recipes,printer) +importFrom(recipes,print_step) importFrom(recipes,rand_id) importFrom(recipes,recipes_eval_select) importFrom(recipes,sel2char) diff --git a/R/0_imports.R b/R/0_imports.R index fa1cf9a..2a4b000 100644 --- a/R/0_imports.R +++ b/R/0_imports.R @@ -2,7 +2,7 @@ #' @importFrom generics tidy #' @importFrom purrr map_dfr map_lgl #' @importFrom recipes add_step bake check_type is_trained prep -#' @importFrom recipes printer rand_id sel2char step recipes_eval_select +#' @importFrom recipes print_step rand_id sel2char step recipes_eval_select #' @importFrom rlang := enquos #' @importFrom ROSE ROSE #' @importFrom tibble as_tibble tibble From 3c9103b8c2637a6ac672a639e18cc35a79bccff5 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Feb 2022 14:56:41 -0800 Subject: [PATCH 2/6] use print_step instead of printer --- R/step_adasyn.R | 4 ++-- R/step_bsmote.R | 4 ++-- R/step_downsample.R | 4 ++-- R/step_nearmiss.R | 4 ++-- R/step_rose.R | 4 ++-- R/step_smote.R | 4 ++-- R/step_tomek.R | 4 ++-- R/step_upsample.R | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/R/step_adasyn.R b/R/step_adasyn.R index bfc643b..8b6759b 100644 --- a/R/step_adasyn.R +++ b/R/step_adasyn.R @@ -186,8 +186,8 @@ bake.step_adasyn <- function(object, new_data, ...) { #' @export print.step_adasyn <- function(x, width = max(20, options()$width - 26), ...) { - cat("adasyn based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "adasyn based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } diff --git a/R/step_bsmote.R b/R/step_bsmote.R index 602bdab..8298060 100644 --- a/R/step_bsmote.R +++ b/R/step_bsmote.R @@ -220,8 +220,8 @@ bake.step_bsmote <- function(object, new_data, ...) { #' @export print.step_bsmote <- function(x, width = max(20, options()$width - 26), ...) { - cat("BorderlineSMOTE based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "BorderlineSMOTE based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } diff --git a/R/step_downsample.R b/R/step_downsample.R index 3edcc36..4b7a5a9 100644 --- a/R/step_downsample.R +++ b/R/step_downsample.R @@ -223,8 +223,8 @@ bake.step_downsample <- function(object, new_data, ...) { print.step_downsample <- function(x, width = max(20, options()$width - 26), ...) { - cat("Down-sampling based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "Down-sampling based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } diff --git a/R/step_nearmiss.R b/R/step_nearmiss.R index 263edc6..b4a7c6c 100644 --- a/R/step_nearmiss.R +++ b/R/step_nearmiss.R @@ -197,8 +197,8 @@ bake.step_nearmiss <- function(object, new_data, ...) { #' @export print.step_nearmiss <- function(x, width = max(20, options()$width - 26), ...) { - cat("NEARMISS-1 based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "NEARMISS-1 based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } diff --git a/R/step_rose.R b/R/step_rose.R index 4547ad0..cdbc51c 100644 --- a/R/step_rose.R +++ b/R/step_rose.R @@ -216,8 +216,8 @@ bake.step_rose <- function(object, new_data, ...) { #' @export print.step_rose <- function(x, width = max(20, options()$width - 26), ...) { - cat("ROSE based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "ROSE based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } diff --git a/R/step_smote.R b/R/step_smote.R index e33e8e9..7e4eeb7 100644 --- a/R/step_smote.R +++ b/R/step_smote.R @@ -193,8 +193,8 @@ bake.step_smote <- function(object, new_data, ...) { #' @export print.step_smote <- function(x, width = max(20, options()$width - 26), ...) { - cat("SMOTE based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "SMOTE based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } diff --git a/R/step_tomek.R b/R/step_tomek.R index 7552d3d..c50b080 100644 --- a/R/step_tomek.R +++ b/R/step_tomek.R @@ -190,8 +190,8 @@ bake.step_tomek <- function(object, new_data, ...) { #' @export print.step_tomek <- function(x, width = max(20, options()$width - 26), ...) { - cat("Tomek based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "Tomek based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } diff --git a/R/step_upsample.R b/R/step_upsample.R index 9d042db..8c604c6 100644 --- a/R/step_upsample.R +++ b/R/step_upsample.R @@ -218,8 +218,8 @@ bake.step_upsample <- function(object, new_data, ...) { print.step_upsample <- function(x, width = max(20, options()$width - 26), ...) { - cat("Up-sampling based on ", sep = "") - printer(x$column, x$terms, x$trained, width = width) + title <- "Up-sampling based on " + print_step(x$column, x$terms, x$trained, width = width, title = title) invisible(x) } From 5e13bb85afadb5e57da4e69c3abb03db7e962f1e Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Feb 2022 15:02:44 -0800 Subject: [PATCH 3/6] update pkgdown GHA --- .github/workflows/pkgdown.yaml | 39 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 6ee8b2a..0b26021 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,45 +1,46 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -# Add Config/Needs/website: tidyverse/tidytemplate to DESCRIPTION on: push: branches: [main, master] - tags: ['*'] pull_request: branches: [main, master] + release: + types: [published] + workflow_dispatch: name: pkgdown jobs: pkgdown: runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: pkgdown + extra-packages: any::pkgdown, local::. needs: website - - name: Install package - run: R CMD INSTALL . - - name: Build site - if: github.event_name == 'pull_request' - run: | - Rscript -e 'pkgdown::build_site()' + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} - - name: Deploy package - if: github.event_name == 'push' - run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + clean: false + branch: gh-pages + folder: docs From 3394a2e217d9cd8cf931a39e6b93dfc0384fcb47 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Feb 2022 15:12:56 -0800 Subject: [PATCH 4/6] cleaner passing of arguments to print_step --- R/step_adasyn.R | 2 +- R/step_bsmote.R | 2 +- R/step_downsample.R | 2 +- R/step_nearmiss.R | 2 +- R/step_rose.R | 2 +- R/step_smote.R | 2 +- R/step_tomek.R | 2 +- R/step_upsample.R | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/step_adasyn.R b/R/step_adasyn.R index 8b6759b..b7587a5 100644 --- a/R/step_adasyn.R +++ b/R/step_adasyn.R @@ -187,7 +187,7 @@ bake.step_adasyn <- function(object, new_data, ...) { print.step_adasyn <- function(x, width = max(20, options()$width - 26), ...) { title <- "adasyn based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } diff --git a/R/step_bsmote.R b/R/step_bsmote.R index 8298060..cc50853 100644 --- a/R/step_bsmote.R +++ b/R/step_bsmote.R @@ -221,7 +221,7 @@ bake.step_bsmote <- function(object, new_data, ...) { print.step_bsmote <- function(x, width = max(20, options()$width - 26), ...) { title <- "BorderlineSMOTE based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } diff --git a/R/step_downsample.R b/R/step_downsample.R index 4b7a5a9..8b077bf 100644 --- a/R/step_downsample.R +++ b/R/step_downsample.R @@ -224,7 +224,7 @@ bake.step_downsample <- function(object, new_data, ...) { print.step_downsample <- function(x, width = max(20, options()$width - 26), ...) { title <- "Down-sampling based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } diff --git a/R/step_nearmiss.R b/R/step_nearmiss.R index b4a7c6c..dfd79da 100644 --- a/R/step_nearmiss.R +++ b/R/step_nearmiss.R @@ -198,7 +198,7 @@ bake.step_nearmiss <- function(object, new_data, ...) { print.step_nearmiss <- function(x, width = max(20, options()$width - 26), ...) { title <- "NEARMISS-1 based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } diff --git a/R/step_rose.R b/R/step_rose.R index cdbc51c..20b0df4 100644 --- a/R/step_rose.R +++ b/R/step_rose.R @@ -217,7 +217,7 @@ bake.step_rose <- function(object, new_data, ...) { print.step_rose <- function(x, width = max(20, options()$width - 26), ...) { title <- "ROSE based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } diff --git a/R/step_smote.R b/R/step_smote.R index 7e4eeb7..a719786 100644 --- a/R/step_smote.R +++ b/R/step_smote.R @@ -194,7 +194,7 @@ bake.step_smote <- function(object, new_data, ...) { print.step_smote <- function(x, width = max(20, options()$width - 26), ...) { title <- "SMOTE based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } diff --git a/R/step_tomek.R b/R/step_tomek.R index c50b080..f4690c7 100644 --- a/R/step_tomek.R +++ b/R/step_tomek.R @@ -191,7 +191,7 @@ bake.step_tomek <- function(object, new_data, ...) { print.step_tomek <- function(x, width = max(20, options()$width - 26), ...) { title <- "Tomek based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } diff --git a/R/step_upsample.R b/R/step_upsample.R index 8c604c6..6d9c598 100644 --- a/R/step_upsample.R +++ b/R/step_upsample.R @@ -219,7 +219,7 @@ bake.step_upsample <- function(object, new_data, ...) { print.step_upsample <- function(x, width = max(20, options()$width - 26), ...) { title <- "Up-sampling based on " - print_step(x$column, x$terms, x$trained, width = width, title = title) + print_step(x$column, x$terms, x$trained, width, title) invisible(x) } From 6add4c0a73ba809cc646d7f31d1b0b2ae90d52f1 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Feb 2022 15:28:31 -0800 Subject: [PATCH 5/6] use correct order of arguments --- R/step_adasyn.R | 2 +- R/step_bsmote.R | 2 +- R/step_downsample.R | 2 +- R/step_nearmiss.R | 2 +- R/step_rose.R | 2 +- R/step_smote.R | 2 +- R/step_tomek.R | 2 +- R/step_upsample.R | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/step_adasyn.R b/R/step_adasyn.R index b7587a5..ae1f68e 100644 --- a/R/step_adasyn.R +++ b/R/step_adasyn.R @@ -187,7 +187,7 @@ bake.step_adasyn <- function(object, new_data, ...) { print.step_adasyn <- function(x, width = max(20, options()$width - 26), ...) { title <- "adasyn based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } diff --git a/R/step_bsmote.R b/R/step_bsmote.R index cc50853..b5686fb 100644 --- a/R/step_bsmote.R +++ b/R/step_bsmote.R @@ -221,7 +221,7 @@ bake.step_bsmote <- function(object, new_data, ...) { print.step_bsmote <- function(x, width = max(20, options()$width - 26), ...) { title <- "BorderlineSMOTE based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } diff --git a/R/step_downsample.R b/R/step_downsample.R index 8b077bf..2c3b187 100644 --- a/R/step_downsample.R +++ b/R/step_downsample.R @@ -224,7 +224,7 @@ bake.step_downsample <- function(object, new_data, ...) { print.step_downsample <- function(x, width = max(20, options()$width - 26), ...) { title <- "Down-sampling based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } diff --git a/R/step_nearmiss.R b/R/step_nearmiss.R index dfd79da..5c9f96f 100644 --- a/R/step_nearmiss.R +++ b/R/step_nearmiss.R @@ -198,7 +198,7 @@ bake.step_nearmiss <- function(object, new_data, ...) { print.step_nearmiss <- function(x, width = max(20, options()$width - 26), ...) { title <- "NEARMISS-1 based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } diff --git a/R/step_rose.R b/R/step_rose.R index 20b0df4..e8d1426 100644 --- a/R/step_rose.R +++ b/R/step_rose.R @@ -217,7 +217,7 @@ bake.step_rose <- function(object, new_data, ...) { print.step_rose <- function(x, width = max(20, options()$width - 26), ...) { title <- "ROSE based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } diff --git a/R/step_smote.R b/R/step_smote.R index a719786..2b31a82 100644 --- a/R/step_smote.R +++ b/R/step_smote.R @@ -194,7 +194,7 @@ bake.step_smote <- function(object, new_data, ...) { print.step_smote <- function(x, width = max(20, options()$width - 26), ...) { title <- "SMOTE based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } diff --git a/R/step_tomek.R b/R/step_tomek.R index f4690c7..ca8a36f 100644 --- a/R/step_tomek.R +++ b/R/step_tomek.R @@ -191,7 +191,7 @@ bake.step_tomek <- function(object, new_data, ...) { print.step_tomek <- function(x, width = max(20, options()$width - 26), ...) { title <- "Tomek based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } diff --git a/R/step_upsample.R b/R/step_upsample.R index 6d9c598..3da6b9c 100644 --- a/R/step_upsample.R +++ b/R/step_upsample.R @@ -219,7 +219,7 @@ bake.step_upsample <- function(object, new_data, ...) { print.step_upsample <- function(x, width = max(20, options()$width - 26), ...) { title <- "Up-sampling based on " - print_step(x$column, x$terms, x$trained, width, title) + print_step(x$column, x$terms, x$trained, title, width) invisible(x) } From 408dfa0ef76c8de028c05b92fdce2f3733c786ff Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Fri, 25 Feb 2022 15:39:12 -0800 Subject: [PATCH 6/6] update to v2 GHA --- .github/workflows/R-CMD-check.yaml | 8 ++++---- .github/workflows/test-coverage.yaml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 4380766..cde41fa 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -37,19 +37,19 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: rcmdcheck - - uses: r-lib/actions/check-r-package@v1 + - uses: r-lib/actions/check-r-package@v2 - name: Show testthat output if: always() diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 3c0da1c..4b01af7 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -17,11 +17,11 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: covr