From 97dceba22f9e4e467add3c9d9659043618cbf2b1 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Fri, 22 Sep 2023 20:14:59 +0200 Subject: [PATCH 01/10] updates to `case_*()` functions --- R/centrality_description.R | 12 ++++++------ R/pairwise_comparisons.R | 4 ++-- R/tidy_model_expressions.R | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/R/centrality_description.R b/R/centrality_description.R index 573a9b76..9dc9f553 100644 --- a/R/centrality_description.R +++ b/R/centrality_description.R @@ -36,14 +36,14 @@ centrality_description <- function(data, tr = 0.2, k = 2L, ...) { - type <- stats_type_switch(type) # styler: off - centrality <- case_when( - type == "parametric" ~ "mean", - type == "nonparametric" ~ "median", - type == "robust" ~ "trimmed", - type == "bayes" ~ "MAP" + centrality <- case_match( + stats_type_switch(type), + "parametric" ~ "mean", + "nonparametric" ~ "median", + "robust" ~ "trimmed", + "bayes" ~ "MAP" ) # styler: on diff --git a/R/pairwise_comparisons.R b/R/pairwise_comparisons.R index 74791b1d..bf6deb02 100644 --- a/R/pairwise_comparisons.R +++ b/R/pairwise_comparisons.R @@ -264,7 +264,7 @@ pairwise_comparisons <- function(data, mutate( expression = case_when( p.adjust.method == "None" ~ glue("list(italic(p)[unadj.]=='{format_value(p.value, k)}')"), - TRUE ~ glue("list(italic(p)['{p.adjust.method}'-adj.]=='{format_value(p.value, k)}')") + .default = glue("list(italic(p)['{p.adjust.method}'-adj.]=='{format_value(p.value, k)}')") ) ) } @@ -296,6 +296,6 @@ p_adjust_text <- function(p.adjust.method) { ), grepl("^BH|^f", p.adjust.method) ~ "FDR", grepl("^BY", p.adjust.method) ~ "BY", - TRUE ~ "Holm" + .default = "Holm" ) } diff --git a/R/tidy_model_expressions.R b/R/tidy_model_expressions.R index 391fac6d..8a637a5d 100644 --- a/R/tidy_model_expressions.R +++ b/R/tidy_model_expressions.R @@ -62,7 +62,7 @@ tidy_model_expressions <- function(data, df %<>% mutate( expression = case_when( df.error %in% c("NA", "Inf") ~ glue("list({es.text}=='{estimate}', italic(t)=='{statistic}', italic(p)=='{p.value}')"), - TRUE ~ glue("list({es.text}=='{estimate}', italic(t)('{df.error}')=='{statistic}', italic(p)=='{p.value}')") + .default = glue("list({es.text}=='{estimate}', italic(t)('{df.error}')=='{statistic}', italic(p)=='{p.value}')") ) ) } @@ -105,7 +105,7 @@ tidy_model_expressions <- function(data, ungroup() %>% # convert from `expression` to `language` mutate(expression = case_when( is.na(unlist(expression)) ~ list(NULL), - TRUE ~ unlist(expression) + .default = unlist(expression) )) %>% .add_package_class() } From 1fb254863d635cadabd4935d8e78fcc15dd7e4de Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Fri, 29 Sep 2023 16:37:22 +0200 Subject: [PATCH 02/10] sync with ggstatsplot workflows --- .covrignore | 2 ++ .github/workflows/R-CMD-check-hard.yaml | 4 +--- .github/workflows/R-CMD-check-strict.yaml | 5 +++-- .github/workflows/R-CMD-check.yaml | 15 ++++++++------- .github/workflows/check-all-examples.yaml | 1 + .github/workflows/check-link-rot.yaml | 6 +++--- .github/workflows/check-random-test-order.yaml | 1 - .github/workflows/check-spelling.yaml | 8 +++++--- .github/workflows/html-5-check.yaml | 1 - .github/workflows/pkgdown-no-suggests.yaml | 4 +--- .github/workflows/styler.yaml | 2 +- .github/workflows/test-coverage-examples.yaml | 5 ++++- .github/workflows/test-coverage.yaml | 5 ++--- 13 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 .covrignore diff --git a/.covrignore b/.covrignore new file mode 100644 index 00000000..a27b3bf9 --- /dev/null +++ b/.covrignore @@ -0,0 +1,2 @@ +R/deprec-*.R +R/compat-*.R diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index 65735bc0..bb46117b 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -27,12 +27,10 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: - r-version: "release" - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/R-CMD-check-strict.yaml b/.github/workflows/R-CMD-check-strict.yaml index 7e4806ba..9a1a707a 100644 --- a/.github/workflows/R-CMD-check-strict.yaml +++ b/.github/workflows/R-CMD-check-strict.yaml @@ -32,18 +32,19 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes + _R_CHECK_CRAN_INCOMING_REMOTE_: true + _R_CHECK_CRAN_INCOMING_: true steps: - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f60b71a6..cd217c11 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -18,13 +18,16 @@ jobs: fail-fast: false matrix: config: - #- {os: macOS-latest, r: 'devel'} - #- { os: macOS-latest, r: "release" } - - { os: macOS-latest, r: "oldrel-1" } + # Checks are not run on R-devel because they are already run in + # `R-CMD-check-strict` workflow + + #- { os: macos-latest, r: 'devel' } + #- { os: macos-latest, r: "release" } + - { os: macos-latest, r: "oldrel-1" } #- { os: windows-latest, r: "devel" } - { os: windows-latest, r: "release" } - - {os: windows-latest, r: 'oldrel-1'} + - { os: windows-latest, r: "oldrel-1" } #- { os: ubuntu-latest, r: "devel" } - { os: ubuntu-latest, r: "release" } @@ -39,12 +42,11 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 @@ -57,4 +59,3 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true - upload-results: true diff --git a/.github/workflows/check-all-examples.yaml b/.github/workflows/check-all-examples.yaml index 7c8e9bd8..1abe1f71 100644 --- a/.github/workflows/check-all-examples.yaml +++ b/.github/workflows/check-all-examples.yaml @@ -39,6 +39,7 @@ jobs: extra-packages: | any::devtools local::. + needs: check - name: Run examples run: | diff --git a/.github/workflows/check-link-rot.yaml b/.github/workflows/check-link-rot.yaml index 86758d2b..80c14c18 100644 --- a/.github/workflows/check-link-rot.yaml +++ b/.github/workflows/check-link-rot.yaml @@ -21,12 +21,11 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: r-version: "devel" - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 @@ -35,7 +34,8 @@ jobs: dependencies: '"hard"' extra-packages: | any::rcmdcheck - r-lib/urlchecker + any::urlchecker + needs: check - name: Run URL checker run: | diff --git a/.github/workflows/check-random-test-order.yaml b/.github/workflows/check-random-test-order.yaml index 5681cdff..06560a16 100644 --- a/.github/workflows/check-random-test-order.yaml +++ b/.github/workflows/check-random-test-order.yaml @@ -19,7 +19,6 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: r-version: "devel" - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/check-spelling.yaml b/.github/workflows/check-spelling.yaml index 7c7c7527..5b1ad61b 100644 --- a/.github/workflows/check-spelling.yaml +++ b/.github/workflows/check-spelling.yaml @@ -3,6 +3,10 @@ on: branches: [main, master] pull_request: branches: [main, master] + schedule: + # * is a special character in YAML so you have to quote this string + # Trigger once a week at 00:00 on Sunday + - cron: "0 0 * * SUN" name: check-spelling @@ -17,12 +21,10 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: - r-version: "devel" - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/html-5-check.yaml b/.github/workflows/html-5-check.yaml index 8d72e82d..8dc89709 100644 --- a/.github/workflows/html-5-check.yaml +++ b/.github/workflows/html-5-check.yaml @@ -20,7 +20,6 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: r-version: "devel" - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/pkgdown-no-suggests.yaml b/.github/workflows/pkgdown-no-suggests.yaml index eb0b1fbf..12ea24c1 100644 --- a/.github/workflows/pkgdown-no-suggests.yaml +++ b/.github/workflows/pkgdown-no-suggests.yaml @@ -25,12 +25,10 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.7" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: - r-version: "release" - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 diff --git a/.github/workflows/styler.yaml b/.github/workflows/styler.yaml index 1696fa17..47adf36a 100644 --- a/.github/workflows/styler.yaml +++ b/.github/workflows/styler.yaml @@ -65,7 +65,7 @@ jobs: - name: Style package run: | options(crayon.enabled = TRUE) - styler::style_pkg(filetype = c(".R", ".Rmd", ".Rmarkdown", ".Rnw")) + styler::style_pkg(filetype = c(".qmd", ".R", ".Rmd", ".Rmarkdown", ".Rnw")) shell: Rscript {0} - name: Document diff --git a/.github/workflows/test-coverage-examples.yaml b/.github/workflows/test-coverage-examples.yaml index 20f2498d..bb7d6c58 100644 --- a/.github/workflows/test-coverage-examples.yaml +++ b/.github/workflows/test-coverage-examples.yaml @@ -11,6 +11,7 @@ name: test-coverage-examples jobs: test-coverage-examples: runs-on: ubuntu-latest + env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -23,9 +24,11 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + pak-version: devel extra-packages: | - r-lib/covr + any::covr local::. + needs: coverage - name: Test example coverage run: | diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index f6529b12..6e07c273 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -19,15 +19,14 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: - http-user-agent: "release" use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 with: pak-version: devel extra-packages: | - r-lib/covr - needs: coverage + any::covr + needs: check - name: Test coverage run: | From 9a050c31ce5cc29e91b5087c4f3086f601234841 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Fri, 29 Sep 2023 16:41:18 +0200 Subject: [PATCH 03/10] fix --- .github/workflows/test-coverage-examples.yaml | 2 +- .github/workflows/test-coverage.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-coverage-examples.yaml b/.github/workflows/test-coverage-examples.yaml index bb7d6c58..61ac89f4 100644 --- a/.github/workflows/test-coverage-examples.yaml +++ b/.github/workflows/test-coverage-examples.yaml @@ -28,7 +28,7 @@ jobs: extra-packages: | any::covr local::. - needs: coverage + needs: coverage - name: Test example coverage run: | diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 6e07c273..733d809e 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -26,7 +26,7 @@ jobs: pak-version: devel extra-packages: | any::covr - needs: check + needs: coverage - name: Test coverage run: | From f767491db2d46a911e3c8b773d266574d6b771a8 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Mon, 2 Oct 2023 15:57:58 +0200 Subject: [PATCH 04/10] fix actions URL on README --- README.Rmd | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.Rmd b/README.Rmd index e158eda6..8d7d2f2a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -26,7 +26,7 @@ library(statsExpressions) Status | Usage | Miscellaneous ----------------- | ----------------- | ----------------- -[![R build status](https://github.com/IndrajeetPatil/statsExpressions/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/statsExpressions) | [![Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/statsExpressions?color=blue)](https://CRAN.R-project.org/package=statsExpressions) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/statsExpressions/branch/main/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/statsExpressions?branch=main) +[![R build status](https://github.com/IndrajeetPatil/statsExpressions/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/statsExpressions/actions) | [![Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/statsExpressions?color=blue)](https://CRAN.R-project.org/package=statsExpressions) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/statsExpressions/branch/main/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/statsExpressions?branch=main) [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | [![Daily downloads](https://cranlogs.r-pkg.org/badges/last-day/statsExpressions?color=blue)](https://CRAN.R-project.org/package=statsExpressions) | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03236/status.svg)](https://doi.org/10.21105/joss.03236) # Introduction diff --git a/README.md b/README.md index fd8c2841..8470a562 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ # `{statsExpressions}`: Tidy dataframes and expressions with statistical details -| Status | Usage | Miscellaneous | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [![R build status](https://github.com/IndrajeetPatil/statsExpressions/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/statsExpressions) | [![Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/statsExpressions?color=blue)](https://CRAN.R-project.org/package=statsExpressions) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/statsExpressions/branch/main/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/statsExpressions?branch=main) | -| [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | [![Daily downloads](https://cranlogs.r-pkg.org/badges/last-day/statsExpressions?color=blue)](https://CRAN.R-project.org/package=statsExpressions) | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03236/status.svg)](https://doi.org/10.21105/joss.03236) | +| Status | Usage | Miscellaneous | +|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [![R build status](https://github.com/IndrajeetPatil/statsExpressions/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/statsExpressions/actions) | [![Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/statsExpressions?color=blue)](https://CRAN.R-project.org/package=statsExpressions) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/statsExpressions/branch/main/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/statsExpressions?branch=main) | +| [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | [![Daily downloads](https://cranlogs.r-pkg.org/badges/last-day/statsExpressions?color=blue)](https://CRAN.R-project.org/package=statsExpressions) | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03236/status.svg)](https://doi.org/10.21105/joss.03236) | # Introduction From 60751a55c28cd00cd31613d9876ad120e2d44dd5 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Thu, 5 Oct 2023 13:57:29 +0200 Subject: [PATCH 05/10] inline more piped calls --- R/one_sample_test.R | 4 ++-- R/oneway_anova.R | 8 ++++---- R/two_sample_test.R | 19 +++++++------------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/R/one_sample_test.R b/R/one_sample_test.R index c2035121..f1c4de81 100644 --- a/R/one_sample_test.R +++ b/R/one_sample_test.R @@ -67,7 +67,7 @@ one_sample_test <- function(data, tidy_model_parameters() %>% select(-matches("^est|^conf|^diff|^term|^ci")) - effsize_df <- exec( + ez_df <- exec( .f.es, x = x_vec, mu = test.value, @@ -76,7 +76,7 @@ one_sample_test <- function(data, ) %>% tidy_model_effectsize() - stats_df <- bind_cols(stats_df, effsize_df) + stats_df <- bind_cols(stats_df, ez_df) } # robust --------------------------------------- diff --git a/R/oneway_anova.R b/R/oneway_anova.R index 945fa875..71158633 100644 --- a/R/oneway_anova.R +++ b/R/oneway_anova.R @@ -203,7 +203,7 @@ oneway_anova <- function(data, stats_df <- tidy_model_parameters(exec(.f, !!!.f.args, data = data)) - effsize_df <- exec( + ez_df <- exec( .fn = .f.es, data = data, ci = conf.level, @@ -213,7 +213,7 @@ oneway_anova <- function(data, ) %>% tidy_model_effectsize() - stats_df <- bind_cols(stats_df, effsize_df) + stats_df <- bind_cols(stats_df, ez_df) } # robust --------------------------------------- @@ -243,11 +243,11 @@ oneway_anova <- function(data, stats_df <- tidy_model_parameters(mod) if (paired) { - effsize_df <- long_to_wide_converter(data, {{ x }}, {{ y }}) %>% + ez_df <- long_to_wide_converter(data, {{ x }}, {{ y }}) %>% WRS2::wmcpAKP(select(-.rowid), tr = tr, nboot = nboot) %>% tidy_model_parameters() - stats_df <- bind_cols(stats_df, effsize_df) + stats_df <- bind_cols(stats_df, ez_df) } } diff --git a/R/two_sample_test.R b/R/two_sample_test.R index 79947688..8598e288 100644 --- a/R/two_sample_test.R +++ b/R/two_sample_test.R @@ -74,12 +74,8 @@ two_sample_test <- function(data, if (type %in% c("parametric", "nonparametric")) { .f.args <- list(x = data[[2L]], y = data[[3L]], paired = paired, alternative = alternative) - - stats_df <- exec(.f, !!!.f.args, var.equal = var.equal, exact = FALSE) %>% - tidy_model_parameters() - - effsize_df <- exec(.f.es, !!!.f.args, pooled_sd = FALSE, ci = conf.level, verbose = FALSE) %>% - tidy_model_effectsize() + stats_df <- exec(.f, !!!.f.args, var.equal = var.equal, exact = FALSE) %>% tidy_model_parameters() + ez_df <- exec(.f.es, !!!.f.args, pooled_sd = FALSE, ci = conf.level, verbose = FALSE) %>% tidy_model_effectsize() } # robust --------------------------------------- @@ -94,25 +90,24 @@ two_sample_test <- function(data, .f.args <- list(formula = new_formula(y, x), data = data, x = data[[2L]], y = data[[3L]]) .f.es.args <- list(EQVAR = FALSE, nboot = nboot, alpha = 1.0 - conf.level, tr = tr) - effsize_df <- tidy_model_parameters(exec(.f.es, !!!.f.args, !!!.f.es.args), keep = "AKP") - stats_df <- tidy_model_parameters(exec(.f, !!!.f.args, !!!.f.es.args)) + ez_df <- tidy_model_parameters(exec(.f.es, !!!.f.args, !!!.f.es.args), keep = "AKP") + stats_df <- tidy_model_parameters(exec(.f, !!!.f.args, !!!.f.es.args)) # styler: on } if (type != "bayes") { - stats_df <- bind_cols(select(stats_df, -matches("^est|^eff|conf|^ci")), select(effsize_df, -matches("term"))) + stats_df <- bind_cols(select(stats_df, -matches("^est|^eff|conf|^ci")), select(ez_df, -matches("term"))) } # Bayesian --------------------------------------- if (type == "bayes") { # styler: off - if (!paired) .f.args <- list(formula = new_formula(y, x), paired = paired) + if (!paired) .f.args <- list(formula = new_formula(y, x), data = as.data.frame(data), paired = paired) if (paired) .f.args <- list(x = data[[2L]], y = data[[3L]], paired = paired) # styler: on - stats_df <- exec(BayesFactor::ttestBF, data = as.data.frame(data), rscale = bf.prior, !!!.f.args) %>% - tidy_model_parameters(ci = conf.level) + stats_df <- exec(BayesFactor::ttestBF, rscale = bf.prior, !!!.f.args) %>% tidy_model_parameters(ci = conf.level) } # expression --------------------------------------- From 24517c1f68d6d30ee5b562015625debca87b436d Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Fri, 6 Oct 2023 21:08:12 +0200 Subject: [PATCH 06/10] bump testthat version --- CITATION.cff | 6 +++--- DESCRIPTION | 2 +- codemeta.json | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 3882b267..dd22d225 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -207,7 +207,7 @@ references: abstract: 'effectsize: Indices of Effect Size' notes: Imports url: https://easystats.github.io/effectsize/ - repository: https://CRAN.R-project.org/package=effectsize + repository: https://easystats.r-universe.dev authors: - family-names: Ben-Shachar given-names: Mattan S. @@ -468,7 +468,7 @@ references: given-names: Jim - family-names: Henry given-names: Lionel - email: lionel@rstudio.com + email: lionel@posit.co - family-names: Müller given-names: Kirill email: krlmlr+r@mailbox.org @@ -707,7 +707,7 @@ references: given-names: Hadley email: hadley@posit.co year: '2023' - version: '>= 3.1.10' + version: '>= 3.2.0' - type: software title: utils abstract: 'R: A Language and Environment for Statistical Computing' diff --git a/DESCRIPTION b/DESCRIPTION index 4b2c7ff3..27423f6f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -55,7 +55,7 @@ Suggests: rmarkdown, rstantools, survival, - testthat (>= 3.1.10), + testthat (>= 3.2.0), utils VignetteBuilder: knitr diff --git a/codemeta.json b/codemeta.json index 71cb37ad..40c80ffd 100644 --- a/codemeta.json +++ b/codemeta.json @@ -161,7 +161,7 @@ "@type": "SoftwareApplication", "identifier": "testthat", "name": "testthat", - "version": ">= 3.1.10", + "version": ">= 3.2.0", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -431,7 +431,7 @@ }, "SystemRequirements": null }, - "fileSize": "4129.449KB", + "fileSize": "4131.402KB", "citation": [ { "@type": "ScholarlyArticle", @@ -463,7 +463,7 @@ ], "releaseNotes": "https://github.com/IndrajeetPatil/statsExpressions/blob/master/NEWS.md", "readme": "https://github.com/IndrajeetPatil/statsExpressions/blob/main/README.md", - "contIntegration": "https://app.codecov.io/gh/IndrajeetPatil/statsExpressions?branch=main", + "contIntegration": ["https://github.com/IndrajeetPatil/statsExpressions/actions", "https://app.codecov.io/gh/IndrajeetPatil/statsExpressions?branch=main"], "developmentStatus": ["https://lifecycle.r-lib.org/articles/stages.html", "https://www.repostatus.org/##active"], "keywords": ["statistical-tests", "statistical-details", "meta-analysis", "contingency-table", "robust", "correlation", "parametric", "bayesian-inference", "bayesian-statistics", "robust-statistics", "effectsize", "tidy"] } From 68546343dcb151d080e1099cc48ef8bc2f37f82c Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Mon, 9 Oct 2023 20:02:01 +0200 Subject: [PATCH 07/10] Update R-CMD-check-hard.yaml --- .github/workflows/R-CMD-check-hard.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index bb46117b..38399e09 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -42,6 +42,7 @@ jobs: any::knitr any::rcmdcheck any::rmarkdown + any::curl any::testthat needs: check From edf5395db1e012e6816674acebc056db5b1d48d4 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 10 Oct 2023 23:23:58 +0200 Subject: [PATCH 08/10] test hygiene --- tests/testthat/helper-state.R | 11 +++++++++++ tests/testthat/helper.R | 20 ++++++++++++++++++++ tests/testthat/test-meta_random_bayes.R | 10 +--------- tests/testthat/test-meta_random_parametric.R | 6 +----- tests/testthat/test-meta_random_robust.R | 5 +---- tests/testthat/test-tidy_model_expressions.R | 6 +----- 6 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 tests/testthat/helper-state.R diff --git a/tests/testthat/helper-state.R b/tests/testthat/helper-state.R new file mode 100644 index 00000000..68ee1e45 --- /dev/null +++ b/tests/testthat/helper-state.R @@ -0,0 +1,11 @@ +testthat::set_state_inspector(function() { + list( + attached = search(), + options = options(), + envvars = Sys.getenv(), + libpaths = .libPaths(), + locale = Sys.getlocale(), + cwd = getwd(), + connections = nrow(getAllConnections()) + ) +}) diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 858b0e80..6a115f7f 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -144,6 +144,26 @@ data_with_subid <- tibble::tribble( 82.5, "1", "9" ) +data_meta <- tibble::tribble( + ~study, ~estimate, ~std.error, + "Morton", -0.83035, 1.24702, + "Rasmussen", -1.05605, 0.41407, + "Smith", -1.27834, 0.80814, + "Abraham", -0.04349, 1.42951, + "Feldstedt", 0.22314, 0.48917, + "Schechter", -2.40752, 1.07221, + "Ceremuzynski", -1.28093, 1.19373, + "Bertschat", -1.1917, 1.66129, + "Singh", -0.69575, 0.53618, + "Pereira", -2.20827, 1.10965, + "Schechter 1", -2.03816, 0.78073, + "Golf", -0.85015, 0.61845, + "Thogersen", -0.79323, 0.62587, + "LIMIT-2", -0.29934, 0.14657, + "Schechter 2", -1.57079, 0.57404, + "ISIS-4", 0.05759, 0.03164 +) + # styler: on # nolint end diff --git a/tests/testthat/test-meta_random_bayes.R b/tests/testthat/test-meta_random_bayes.R index 4809cf81..974bd574 100644 --- a/tests/testthat/test-meta_random_bayes.R +++ b/tests/testthat/test-meta_random_bayes.R @@ -1,20 +1,12 @@ -# there is z in this file's name for a reason -# Bayesian meta-analysis often crashes R session on macOS -# this makes sure this test will be run after all others - test_that( desc = "meta_analysis works - bayesian", code = { skip_if_not_installed("metaBMA") - skip_if_not_installed("metaplus") - - data(mag, package = "metaplus") - dat <- dplyr::rename(mag, estimate = yi, std.error = sei) set.seed(123) df <- suppressWarnings(meta_analysis( type = "bayes", - data = dat, + data = data_meta, k = 3L, iter = 1000L, summarize = "integrate" diff --git a/tests/testthat/test-meta_random_parametric.R b/tests/testthat/test-meta_random_parametric.R index 99d31022..0e7b5183 100644 --- a/tests/testthat/test-meta_random_parametric.R +++ b/tests/testthat/test-meta_random_parametric.R @@ -2,13 +2,9 @@ test_that( desc = "meta_analysis works - parametric", code = { skip_if_not_installed("metafor") - skip_if_not_installed("metaplus") - - data(mag, package = "metaplus") - dat <- mag %>% rename(estimate = yi, std.error = sei) set.seed(123) - df <- suppressWarnings(meta_analysis(dat)) + df <- suppressWarnings(meta_analysis(data_meta)) set.seed(123) expect_snapshot(select(df, -expression)) diff --git a/tests/testthat/test-meta_random_robust.R b/tests/testthat/test-meta_random_robust.R index 7ffaf8d3..dcdf907e 100644 --- a/tests/testthat/test-meta_random_robust.R +++ b/tests/testthat/test-meta_random_robust.R @@ -3,12 +3,9 @@ test_that( code = { skip_if_not_installed("metaplus") - data(mag, package = "metaplus") - dat <- mag %>% rename(estimate = yi, std.error = sei) - set.seed(123) df <- meta_analysis( - data = dat, + data = data_meta, type = "robust", random = "normal" ) diff --git a/tests/testthat/test-tidy_model_expressions.R b/tests/testthat/test-tidy_model_expressions.R index 9fe19f5d..c6035414 100644 --- a/tests/testthat/test-tidy_model_expressions.R +++ b/tests/testthat/test-tidy_model_expressions.R @@ -32,9 +32,8 @@ test_that("tidy_model_expressions works - t", { test_that("tidy_model_expressions works - chi2", { skip_if_not_installed("survival") - library(survival) + withr::local_package("survival") - # model mod_chi <- survival::coxph( formula = Surv(time, status) ~ age + sex + frailty(inst), data = lung @@ -58,7 +57,6 @@ test_that("tidy_model_expressions works - chi2", { test_that("tidy_model_expressions works - z", { df <- as.data.frame(Titanic) - # model mod_z <- stats::glm( formula = Survived ~ Sex + Age, data = df, @@ -78,8 +76,6 @@ test_that("tidy_model_expressions works - z", { test_that("tidy_model_expressions works - F", { - ## F-statistic -------------------------------- - set.seed(123) mod_f <- aov(yield ~ N * P + Error(block), npk) From 051976c98cda8ecc1054da1aae9cd154e9873d32 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 10 Oct 2023 23:34:52 +0200 Subject: [PATCH 09/10] fix test warnings --- tests/testthat/helper-state.R | 7 ++++--- tests/testthat/test-meta_random_robust.R | 6 +----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/testthat/helper-state.R b/tests/testthat/helper-state.R index 68ee1e45..881c732a 100644 --- a/tests/testthat/helper-state.R +++ b/tests/testthat/helper-state.R @@ -1,11 +1,12 @@ testthat::set_state_inspector(function() { list( attached = search(), - options = options(), + connections = getAllConnections(), + cwd = getwd(), envvars = Sys.getenv(), libpaths = .libPaths(), locale = Sys.getlocale(), - cwd = getwd(), - connections = nrow(getAllConnections()) + options = .Options, + NULL ) }) diff --git a/tests/testthat/test-meta_random_robust.R b/tests/testthat/test-meta_random_robust.R index dcdf907e..bc18238e 100644 --- a/tests/testthat/test-meta_random_robust.R +++ b/tests/testthat/test-meta_random_robust.R @@ -4,11 +4,7 @@ test_that( skip_if_not_installed("metaplus") set.seed(123) - df <- meta_analysis( - data = data_meta, - type = "robust", - random = "normal" - ) + df <- meta_analysis(data_meta, type = "robust", random = "normal") set.seed(123) expect_snapshot(select(df, -expression)) From 805ddce62bd61b0618af412b303658f435a82936 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 10 Oct 2023 23:43:45 +0200 Subject: [PATCH 10/10] Update helper-state.R --- tests/testthat/helper-state.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testthat/helper-state.R b/tests/testthat/helper-state.R index 881c732a..588923f3 100644 --- a/tests/testthat/helper-state.R +++ b/tests/testthat/helper-state.R @@ -1,12 +1,13 @@ testthat::set_state_inspector(function() { list( attached = search(), - connections = getAllConnections(), + connections = nrow(showConnections()), cwd = getwd(), envvars = Sys.getenv(), libpaths = .libPaths(), locale = Sys.getlocale(), options = .Options, + packages = .packages(all.available = TRUE), NULL ) })