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..38399e09 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
@@ -44,6 +42,7 @@ jobs:
any::knitr
any::rcmdcheck
any::rmarkdown
+ any::curl
any::testthat
needs: check
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 22ca8cdb..2560236a 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..61ac89f4 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..733d809e 100644
--- a/.github/workflows/test-coverage.yaml
+++ b/.github/workflows/test-coverage.yaml
@@ -19,14 +19,13 @@ 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
+ any::covr
needs: coverage
- name: Test coverage
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/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/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/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()
}
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 ---------------------------------------
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
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"]
}
diff --git a/tests/testthat/helper-state.R b/tests/testthat/helper-state.R
new file mode 100644
index 00000000..588923f3
--- /dev/null
+++ b/tests/testthat/helper-state.R
@@ -0,0 +1,13 @@
+testthat::set_state_inspector(function() {
+ list(
+ attached = search(),
+ connections = nrow(showConnections()),
+ cwd = getwd(),
+ envvars = Sys.getenv(),
+ libpaths = .libPaths(),
+ locale = Sys.getlocale(),
+ options = .Options,
+ packages = .packages(all.available = TRUE),
+ NULL
+ )
+})
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..bc18238e 100644
--- a/tests/testthat/test-meta_random_robust.R
+++ b/tests/testthat/test-meta_random_robust.R
@@ -3,15 +3,8 @@ 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,
- type = "robust",
- random = "normal"
- )
+ df <- meta_analysis(data_meta, type = "robust", random = "normal")
set.seed(123)
expect_snapshot(select(df, -expression))
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)