Skip to content

Commit

Permalink
Fix failing tests from easystats updates (#974)
Browse files Browse the repository at this point in the history
* Style with latest styler

* consolidate warning-as-errors into one workflow
  • Loading branch information
IndrajeetPatil authored Dec 3, 2024
1 parent 450fa64 commit d312b9f
Show file tree
Hide file tree
Showing 21 changed files with 419 additions and 475 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/check-all-examples.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Run tests with `options(warn = 2)` to fail on test warnings
# execute all examples, tests, and vignettes with warnings turned into errors
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: check-test-warnings
name: check-no-warnings

jobs:
check-test-warnings:
check-no-warnings:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -18,25 +18,38 @@ jobs:

- uses: r-lib/actions/setup-r@v2
with:
r-version: "devel"
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
pak-version: devel
upgrade: 'TRUE'
extra-packages: |
any::devtools
local::.
needs: check
- name: Run examples
run: |
options(crayon.enabled = TRUE, warn = 2L)
devtools::run_examples(fresh = TRUE, run_dontrun = TRUE, run_donttest = TRUE)
shell: Rscript {0}

- name: Run Tests
run: |
options(crayon.enabled = TRUE)
pkgload::load_all()
# this workaround needed to play nicely with parallel testing
# see: https://github.com/r-lib/testthat/issues/1912
test_script_paths <- testthat::find_test_scripts("tests/testthat")
test_with_warning_as_error <- function(path) {
withr::local_options(list(warn = 2L))
testthat::test_file(path, stop_on_failure = TRUE, stop_on_warning = TRUE)
}
purrr::walk(test_script_paths, test_with_warning_as_error)
shell: Rscript {0}

- name: Build vignettes
run: |
options(crayon.enabled = TRUE, warn = 2L)
vignettes <- fs::dir_ls("vignettes/", glob = "*.Rmd", recurse = TRUE)
purrr::walk(vignettes, rmarkdown::render)
shell: Rscript {0}
41 changes: 0 additions & 41 deletions .github/workflows/check-vignette-warnings.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.6.9
uses: JamesIves/github-pages-deploy-action@v4.7.1
with:
branch: gh-pages
folder: docs
10 changes: 6 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "ggstatsplot" in publications use:'
type: software
license: GPL-3.0-only
title: 'ggstatsplot: ''ggplot2'' Based Plots with Statistical Details'
version: 0.12.5
version: 0.12.5.9000
doi: 10.21105/joss.03167
identifiers:
- type: doi
Expand Down Expand Up @@ -73,7 +73,7 @@ references:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
version: '>= 4.1.0'
version: '>= 4.3.0'
- type: software
title: correlation
abstract: 'correlation: Methods for Correlation Analysis'
Expand Down Expand Up @@ -326,7 +326,7 @@ references:
orcid: https://orcid.org/0000-0002-9271-5075
year: '2024'
doi: 10.32614/CRAN.package.insight
version: '>= 0.20.5'
version: '>= 1.0.0'
- type: software
title: paletteer
abstract: 'paletteer: Comprehensive Collection of Color Palettes'
Expand Down Expand Up @@ -371,7 +371,7 @@ references:
orcid: https://orcid.org/0000-0001-9560-6336
year: '2024'
doi: 10.32614/CRAN.package.parameters
version: '>= 0.23.0'
version: '>= 0.24.0'
- type: software
title: patchwork
abstract: 'patchwork: The Composer of Plots'
Expand Down Expand Up @@ -596,6 +596,8 @@ references:
- family-names: Ripley
given-names: Brian
email: [email protected]
- family-names: Venables
given-names: Bill
year: '2024'
doi: 10.32614/CRAN.package.MASS
- type: software
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Imports:
ggside (>= 0.3.1),
ggsignif (>= 0.6.4),
glue (>= 1.8.0),
insight (>= 0.20.5),
insight (>= 1.0.0),
paletteer (>= 1.6.0),
parameters (>= 0.23.0),
parameters (>= 0.24.0),
patchwork (>= 1.3.0),
performance (>= 0.12.4),
purrr (>= 1.0.2),
Expand Down
11 changes: 6 additions & 5 deletions R/combine-plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@
#' )
#' @export
combine_plots <- function(
plotlist,
plotgrid.args = list(),
annotation.args = list(),
guides = "collect",
...) {
plotlist,
plotgrid.args = list(),
annotation.args = list(),
guides = "collect",
...
) {
exec(patchwork::wrap_plots, !!!plotlist, guides = guides, !!!plotgrid.args) +
exec(patchwork::plot_annotation, !!!annotation.args)
}
1 change: 0 additions & 1 deletion R/extract-stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ extract_stats <- function(p) {
}



# function factory to extract particular kind of stats data
.extract_stats_data <- function(data_component) {
function(p) {
Expand Down
72 changes: 37 additions & 35 deletions R/ggbarstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,37 @@
#' extract_stats(p)
#' @export
ggbarstats <- function(
data,
x,
y,
counts = NULL,
type = "parametric",
paired = FALSE,
results.subtitle = TRUE,
label = "percentage",
label.args = list(alpha = 1.0, fill = "white"),
sample.size.label.args = list(size = 4.0),
digits = 2L,
proportion.test = results.subtitle,
digits.perc = 0L,
bf.message = TRUE,
ratio = NULL,
conf.level = 0.95,
sampling.plan = "indepMulti",
fixed.margin = "rows",
prior.concentration = 1.0,
title = NULL,
subtitle = NULL,
caption = NULL,
legend.title = NULL,
xlab = NULL,
ylab = NULL,
ggtheme = ggstatsplot::theme_ggstatsplot(),
package = "RColorBrewer",
palette = "Dark2",
ggplot.component = NULL,
...) {
data,
x,
y,
counts = NULL,
type = "parametric",
paired = FALSE,
results.subtitle = TRUE,
label = "percentage",
label.args = list(alpha = 1.0, fill = "white"),
sample.size.label.args = list(size = 4.0),
digits = 2L,
proportion.test = results.subtitle,
digits.perc = 0L,
bf.message = TRUE,
ratio = NULL,
conf.level = 0.95,
sampling.plan = "indepMulti",
fixed.margin = "rows",
prior.concentration = 1.0,
title = NULL,
subtitle = NULL,
caption = NULL,
legend.title = NULL,
xlab = NULL,
ylab = NULL,
ggtheme = ggstatsplot::theme_ggstatsplot(),
package = "RColorBrewer",
palette = "Dark2",
ggplot.component = NULL,
...
) {
# data frame ------------------------------------------

# make sure both quoted and unquoted arguments are allowed
Expand Down Expand Up @@ -221,11 +222,12 @@ ggbarstats <- function(
#' )
#' @export
grouped_ggbarstats <- function(
data,
...,
grouping.var,
plotgrid.args = list(),
annotation.args = list()) {
data,
...,
grouping.var,
plotgrid.args = list(),
annotation.args = list()
) {
.grouped_list(data, {{ grouping.var }}) %>%
purrr::pmap(.f = ggbarstats, ...) %>%
combine_plots(plotgrid.args, annotation.args)
Expand Down
Loading

0 comments on commit d312b9f

Please sign in to comment.