diff --git a/.github/workflows/check-full.yaml b/.github/workflows/check-full.yaml index a520b70f5..a85f29f2d 100644 --- a/.github/workflows/check-full.yaml +++ b/.github/workflows/check-full.yaml @@ -39,6 +39,8 @@ jobs: - uses: actions/checkout@v2 - uses: r-lib/actions/setup-pandoc@v2 + with: + pandoc-version: '2.19.2' - uses: r-lib/actions/setup-r@v2 with: @@ -48,7 +50,10 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + pak-version: devel extra-packages: any::rcmdcheck needs: check - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ffa272d17..0800e9a32 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -22,6 +22,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + pak-version: devel extra-packages: r-lib/lintr needs: lint diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index e5ecec9f6..c546d4976 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -24,7 +24,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: '2.18' + pandoc-version: '2.19.2' - uses: r-lib/actions/setup-r@v2 with: @@ -32,6 +32,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + pak-version: devel extra-packages: r-lib/pkgdown, local::. needs: website diff --git a/.github/workflows/render-readme.yml b/.github/workflows/render-readme.yml index eb56091ef..cdf377f31 100644 --- a/.github/workflows/render-readme.yml +++ b/.github/workflows/render-readme.yml @@ -22,6 +22,8 @@ jobs: fetch-depth: 0 - uses: r-lib/actions/setup-pandoc@v2 + with: + pandoc-version: '2.19.2' - uses: r-lib/actions/setup-r@v2 @@ -29,6 +31,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + pak-version: devel extra-packages: | deps::. any::ggstatsplot diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 8657d8f38..ad33a1c56 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -23,6 +23,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: + pak-version: devel extra-packages: r-lib/covr needs: coverage diff --git a/API b/API index 74fef9e6f..a6a12f311 100644 --- a/API +++ b/API @@ -6,7 +6,7 @@ combine_plots(plotlist, plotgrid.args = list(), annotation.args = list(), guides extract_stats(p, ...) ggbarstats(data, x, y, counts = NULL, type = "parametric", paired = FALSE, results.subtitle = TRUE, label = "percentage", label.args = list(alpha = 1, fill = "white"), k = 2L, proportion.test = results.subtitle, perc.k = 0L, bf.message = TRUE, ratio = NULL, conf.level = 0.95, sampling.plan = "indepMulti", fixed.margin = "rows", prior.concentration = 1, title = NULL, subtitle = NULL, caption = NULL, legend.title = NULL, xlab = NULL, ylab = NULL, ggtheme = ggstatsplot::theme_ggstatsplot(), package = "RColorBrewer", palette = "Dark2", ggplot.component = NULL, output = "plot", ...) ggbetweenstats(data, x, y, plot.type = "boxviolin", type = "parametric", pairwise.comparisons = TRUE, pairwise.display = "significant", p.adjust.method = "holm", effsize.type = "unbiased", bf.prior = 0.707, bf.message = TRUE, results.subtitle = TRUE, xlab = NULL, ylab = NULL, caption = NULL, title = NULL, subtitle = NULL, k = 2L, var.equal = FALSE, conf.level = 0.95, nboot = 100L, tr = 0.2, centrality.plotting = TRUE, centrality.type = type, centrality.point.args = list(size = 5, color = "darkred"), centrality.label.args = list(size = 3, nudge_x = 0.4, segment.linetype = 4, min.segment.length = 0), outlier.tagging = FALSE, outlier.label = NULL, outlier.coef = 1.5, outlier.shape = 19, outlier.color = "black", outlier.label.args = list(size = 3), point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.6), alpha = 0.4, size = 3, stroke = 0), violin.args = list(width = 0.5, alpha = 0.2), ggsignif.args = list(textsize = 3, tip_length = 0.01), ggtheme = ggstatsplot::theme_ggstatsplot(), package = "RColorBrewer", palette = "Dark2", ggplot.component = NULL, output = "plot", ...) -ggcoefstats(x, output = "plot", statistic = NULL, conf.int = TRUE, conf.level = 0.95, k = 2L, exclude.intercept = FALSE, effsize = "eta", meta.analytic.effect = FALSE, meta.type = "parametric", bf.message = TRUE, sort = "none", xlab = NULL, ylab = NULL, title = NULL, subtitle = NULL, caption = NULL, only.significant = FALSE, point.args = list(size = 3, color = "blue"), errorbar.args = list(height = 0), vline = TRUE, vline.args = list(size = 1, linetype = "dashed"), stats.labels = TRUE, stats.label.color = NULL, stats.label.args = list(size = 3, direction = "y", min.segment.length = 0), package = "RColorBrewer", palette = "Dark2", ggtheme = ggstatsplot::theme_ggstatsplot(), ...) +ggcoefstats(x, output = "plot", statistic = NULL, conf.int = TRUE, conf.level = 0.95, k = 2L, exclude.intercept = FALSE, effectsize.type = "eta", meta.analytic.effect = FALSE, meta.type = "parametric", bf.message = TRUE, sort = "none", xlab = NULL, ylab = NULL, title = NULL, subtitle = NULL, caption = NULL, only.significant = FALSE, point.args = list(size = 3, color = "blue"), errorbar.args = list(height = 0), vline = TRUE, vline.args = list(size = 1, linetype = "dashed"), stats.labels = TRUE, stats.label.color = NULL, stats.label.args = list(size = 3, direction = "y", min.segment.length = 0), package = "RColorBrewer", palette = "Dark2", ggtheme = ggstatsplot::theme_ggstatsplot(), ...) ggcorrmat(data, cor.vars = NULL, cor.vars.names = NULL, output = "plot", matrix.type = "upper", type = "parametric", tr = 0.2, partial = FALSE, k = 2L, sig.level = 0.05, conf.level = 0.95, bf.prior = 0.707, p.adjust.method = "holm", pch = "cross", ggcorrplot.args = list(method = "square", outline.color = "black", pch.cex = 14), package = "RColorBrewer", palette = "Dark2", colors = c("#E69F00", "white", "#009E73"), ggtheme = ggstatsplot::theme_ggstatsplot(), ggplot.component = NULL, title = NULL, subtitle = NULL, caption = NULL, ...) ggdotplotstats(data, x, y, xlab = NULL, ylab = NULL, title = NULL, subtitle = NULL, caption = NULL, type = "parametric", test.value = 0, bf.prior = 0.707, bf.message = TRUE, effsize.type = "g", conf.level = 0.95, tr = 0.2, k = 2L, results.subtitle = TRUE, point.args = list(color = "black", size = 3, shape = 16), centrality.plotting = TRUE, centrality.type = type, centrality.line.args = list(color = "blue", size = 1, linetype = "dashed"), ggplot.component = NULL, ggtheme = ggstatsplot::theme_ggstatsplot(), output = "plot", ...) gghistostats(data, x, binwidth = NULL, xlab = NULL, title = NULL, subtitle = NULL, caption = NULL, type = "parametric", test.value = 0, bf.prior = 0.707, bf.message = TRUE, effsize.type = "g", conf.level = 0.95, tr = 0.2, k = 2L, ggtheme = ggstatsplot::theme_ggstatsplot(), results.subtitle = TRUE, bin.args = list(color = "black", fill = "grey50", alpha = 0.7), centrality.plotting = TRUE, centrality.type = type, centrality.line.args = list(color = "blue", size = 1, linetype = "dashed"), normal.curve = FALSE, normal.curve.args = list(size = 2), ggplot.component = NULL, output = "plot", ...) @@ -22,19 +22,3 @@ grouped_ggpiestats(data, ..., grouping.var, output = "plot", plotgrid.args = lis grouped_ggscatterstats(data, ..., grouping.var, output = "plot", plotgrid.args = list(), annotation.args = list()) grouped_ggwithinstats(data, ..., grouping.var, output = "plot", plotgrid.args = list(), annotation.args = list()) theme_ggstatsplot() - -## Reexported objects - -rlang::!! -rlang::!!! -magrittr::%$% -zeallot::%<-% -magrittr::%<>% -magrittr::%>% -rlang::%|% -rlang::%||% -rlang:::= -tibble::as_tibble -rlang::exec -statsExpressions::pairwise_comparisons -tibble::tibble diff --git a/CITATION.cff b/CITATION.cff index 5c6926e5a..630dcb125 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,5 +1,5 @@ # ----------------------------------------------------------- -# CITATION file created with {cffr} R package, v0.2.3 +# CITATION file created with {cffr} R package, v0.3.0 # See also: https://docs.ropensci.org/cffr/ # ----------------------------------------------------------- @@ -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.9.4.9000 +version: 0.9.5 doi: 10.21105/joss.03167 abstract: 'Extension of ''ggplot2'', ''ggstatsplot'' creates graphics with details from statistical tests included in the plots themselves. It provides an easier syntax @@ -17,7 +17,7 @@ abstract: 'Extension of ''ggplot2'', ''ggstatsplot'' creates graphics with detai (pie and bar charts) data. Currently, it supports the most common types of statistical approaches and tests: parametric, nonparametric, robust, and Bayesian versions of t-test/ANOVA, correlation analyses, contingency table analysis, meta-analysis, and - regression analyses.' + regression analyses. References: Patil (2021) <10.21105/joss.03236>.' authors: - family-names: Patil given-names: Indrajeet @@ -106,9 +106,9 @@ references: given-names: Mattan S. email: matanshm@post.bgu.ac.il orcid: https://orcid.org/0000-0002-4287-4801 - url: https://easystats.github.io/correlation/ - version: '>= 0.8.2' year: '2022' + url: https://CRAN.R-project.org/package=correlation + version: '>= 0.8.3' - type: software title: datawizard abstract: 'datawizard: Easy Data Wrangling and Statistical Transformations' @@ -139,7 +139,7 @@ references: email: etienne.bacher@protonmail.com orcid: https://orcid.org/0000-0002-9271-5075 url: https://easystats.github.io/datawizard/ - version: '>= 0.5.0' + version: '>= 0.6.2' year: '2022' - type: software title: dplyr @@ -268,8 +268,8 @@ references: email: vincent.arel-bundock@umontreal.ca orcid: https://orcid.org/0000-0003-2042-7063 year: '2022' - url: https://easystats.github.io/insight/ - version: '>= 0.18.2' + url: https://CRAN.R-project.org/package=insight + version: '>= 0.18.5' - type: software title: paletteer abstract: 'paletteer: Comprehensive Collection of Color Palettes' @@ -307,9 +307,9 @@ references: given-names: Brenton M. email: brenton@wiernik.org orcid: https://orcid.org/0000-0001-9560-6336 - year: '2022' url: https://easystats.github.io/parameters/ - version: '>= 0.18.2' + version: '>= 0.19.0' + year: '2022' - type: software title: patchwork abstract: 'patchwork: The Composer of Plots' @@ -352,7 +352,7 @@ references: orcid: https://orcid.org/0000-0001-9560-6336 year: '2022' url: https://easystats.github.io/performance/ - version: '>= 0.9.2' + version: '>= 0.10.0' - type: software title: purrr abstract: 'purrr: Functional Programming Tools' @@ -400,8 +400,9 @@ references: given-names: Indrajeet email: patilindrajeet.science@gmail.com orcid: https://orcid.org/0000-0003-1995-6531 - version: '>= 1.3.3' year: '2022' + url: https://CRAN.R-project.org/package=statsExpressions + version: '>= 1.3.4' - type: software title: tidyr abstract: 'tidyr: Tidy Messy Data' diff --git a/DESCRIPTION b/DESCRIPTION index 9e500ba74..98166db22 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ggstatsplot Title: 'ggplot2' Based Plots with Statistical Details -Version: 0.9.4.9000 +Version: 0.9.5 Authors@R: c(person(given = "Indrajeet", family = "Patil", @@ -23,6 +23,7 @@ Description: Extension of 'ggplot2', 'ggstatsplot' creates graphics with statistical approaches and tests: parametric, nonparametric, robust, and Bayesian versions of t-test/ANOVA, correlation analyses, contingency table analysis, meta-analysis, and regression analyses. + References: Patil (2021) . License: GPL-3 | file LICENSE URL: https://indrajeetpatil.github.io/ggstatsplot/, https://github.com/IndrajeetPatil/ggstatsplot @@ -30,22 +31,22 @@ BugReports: https://github.com/IndrajeetPatil/ggstatsplot/issues Depends: R (>= 4.0.0) Imports: - correlation (>= 0.8.2), - datawizard (>= 0.5.0), + correlation (>= 0.8.3), + datawizard (>= 0.6.2), dplyr, ggplot2, ggrepel, ggsignif, glue, - insight (>= 0.18.2), + insight (>= 0.18.5), paletteer, - parameters (>= 0.18.2), + parameters (>= 0.19.0), patchwork, - performance (>= 0.9.2), + performance (>= 0.10.0), purrr, rlang, stats, - statsExpressions (>= 1.3.3), + statsExpressions (>= 1.3.4), tidyr, utils Suggests: @@ -74,8 +75,10 @@ VignetteBuilder: Encoding: UTF-8 Language: en-US LazyData: true -Roxygen: list(markdown = TRUE, roclets = c("rd", "namespace", "collate", - "pkgapi::api_roclet")) +Roxygen: list( + markdown = TRUE, + roclets = c("rd", "namespace", "collate", "pkgapi::api_roclet") + ) RoxygenNote: 7.2.1 Config/testthat/edition: 3 Config/testthat/parallel: true diff --git a/NAMESPACE b/NAMESPACE index 86e9ec783..73365842d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,17 +1,7 @@ # Generated by roxygen2: do not edit by hand -export("!!!") -export("!!") -export("%$%") -export("%<-%") -export("%<>%") export("%>%") -export("%|%") -export("%||%") -export(":=") -export(as_tibble) export(combine_plots) -export(exec) export(extract_stats) export(ggbarstats) export(ggbetweenstats) @@ -32,7 +22,6 @@ export(grouped_ggscatterstats) export(grouped_ggwithinstats) export(pairwise_comparisons) export(theme_ggstatsplot) -export(tibble) import(dplyr) import(ggplot2) import(rlang) @@ -55,16 +44,6 @@ importFrom(patchwork,wrap_plots) importFrom(performance,check_outliers) importFrom(purrr,is_bare_numeric) importFrom(purrr,keep) -importFrom(rlang,"!!!") -importFrom(rlang,"!!") -importFrom(rlang,"%|%") -importFrom(rlang,"%||%") -importFrom(rlang,":=") -importFrom(rlang,exec) importFrom(statsExpressions,"%$%") -importFrom(statsExpressions,"%<-%") -importFrom(statsExpressions,"%<>%") importFrom(statsExpressions,"%>%") -importFrom(statsExpressions,as_tibble) importFrom(statsExpressions,pairwise_comparisons) -importFrom(statsExpressions,tibble) diff --git a/NEWS.md b/NEWS.md index 3f175cb80..967f0da9e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,23 @@ -# ggstatsplot 0.9.4 +# ggstatsplot 0.9.5 N.B. All statistical analysis in `{ggstatsplot}` is carried out in `{statsExpressions}`. Thus, to see changes related to statistical expressions, read the `NEWS` for that package: +MAJOR CHANGES + +- Due to changes to the underlying API of `{parameters}`, the `effsize` argument + has been renamed to `effectsize.type`. + +- Removes unnecessary re-exports of `{tidyverse}` operators. + +MINOR CHANGES + +- Fixes tests for changes in dependencies. + +# ggstatsplot 0.9.4 + - Internal housekeeping to adjust to changes in upstream dependencies. # ggstatsplot 0.9.3 diff --git a/R/ggcoefstats.R b/R/ggcoefstats.R index fe23ce596..5190e1b87 100644 --- a/R/ggcoefstats.R +++ b/R/ggcoefstats.R @@ -7,19 +7,20 @@ #' confidence interval whiskers and other statistical details included as #' labels. #' -#' @param x A model object to be tidied, or a tidy data frame containing results -#' from a regression model. Function internally uses -#' `parameters::model_parameters()` to get a tidy data frame. If a data frame is -#' entered, it *must* contain at the minimum two columns named `term` (names -#' of predictors) and `estimate` (corresponding estimates of coefficients or -#' other quantities of interest). +#' @param x A model object to be tidied, or a tidy data frame from a regression +#' model. Function internally uses `parameters::model_parameters()` to get a +#' tidy data frame. If a data frame, it *must* contain at the minimum two +#' columns named `term` (names of predictors) and `estimate` (corresponding +#' estimates of coefficients or other quantities of interest). #' @param output Character describing the expected output from this function: -#' `"plot"` (visualization of regression coefficients) or `"tidy"` (tidy -#' data frame of results `parameters::model_parameters`) or `"glance"` (object -#' from `performance::model_performance`). -#' @param statistic Which statistic is to be displayed (either `"t"` or `"f"`or -#' `"z"` or `"chi"`) in the label. This is relevant if the `x` argument is a -#' *data frame*. +#' - `"plot"` (visualization of regression coefficients) +#' - `"tidy"` (tidy data frame of results `parameters::model_parameters()`) +#' - `"glance"` (object from `performance::model_performance()`) +#' @param statistic Relevant statistic for the model (`"t"`, `"f"`, `"z"`, or +#' `"chi"`) in the label. Relevant only if `x` is a *data frame*. +#' @param effectsize.type This is the same as `effectsize_type` argument of +#' `parameters::model_parameters()`. Defaults to `"eta"`, and relevant for +#' ANOVA-like objects. #' @param bf.message Logical that decides whether results from running a #' Bayesian meta-analysis assuming that the effect size *d* varies across #' studies with standard deviation *t* (i.e., a random-effects analysis) @@ -33,9 +34,6 @@ #' error bars (Default: `TRUE`). #' @param conf.level Numeric deciding level of confidence or credible intervals #' (Default: `0.95`). -#' @param effsize Character describing the effect size to be displayed: `"eta"` -#' (default) or `"omega"`. This argument is relevant only for models objects -#' with *F*-statistic. #' @param meta.analytic.effect Logical that decides whether subtitle for #' meta-analysis via linear (mixed-effects) models (default: `FALSE`). If #' `TRUE`, input to argument `subtitle` will be ignored. This will be mostly @@ -80,16 +78,16 @@ #' @note #' #' 1. In case you want to carry out meta-analysis, you will be asked to install -#' the needed packages (`{metafor}`, `{metaplus}`, or `{metaBMA}`) for -#' meta-analysis (if unavailable). +#' the needed packages (`{metafor}`, `{metaplus}`, or `{metaBMA}`) if they are +#' unavailable. #' #' 2. All rows of regression estimates where either of the following -#' quantities is `NA` will be removed if labels are requested: `estimate`, -#' `statistic`, `p.value`. +#' quantities is `NA` will be removed if labels are requested: +#' `estimate`, `statistic`, `p.value`. #' #' 3. Given the rapid pace at which new methods are added to these packages, it -#' is recommended that you install the GitHub versions of `{parameters}` and -#' `{performance}` in order to make most of this function. +#' is recommended that you install development versions of `{easystats}` +#' packages using the `install_latest()` function from `{easystats}`. #' #' @details For details, see: #' @@ -124,7 +122,7 @@ ggcoefstats <- function(x, conf.level = 0.95, k = 2L, exclude.intercept = FALSE, - effsize = "eta", + effectsize.type = "eta", meta.analytic.effect = FALSE, meta.type = "parametric", bf.message = TRUE, @@ -135,20 +133,13 @@ ggcoefstats <- function(x, subtitle = NULL, caption = NULL, only.significant = FALSE, - point.args = list(size = 3, color = "blue"), - errorbar.args = list(height = 0), + point.args = list(size = 3, color = "blue", na.rm = TRUE), + errorbar.args = list(height = 0, na.rm = TRUE), vline = TRUE, - vline.args = list( - size = 1, - linetype = "dashed" - ), + vline.args = list(size = 1, linetype = "dashed"), stats.labels = TRUE, stats.label.color = NULL, - stats.label.args = list( - size = 3, - direction = "y", - min.segment.length = 0 - ), + stats.label.args = list(size = 3, direction = "y", min.segment.length = 0), package = "RColorBrewer", palette = "Dark2", ggtheme = ggstatsplot::theme_ggstatsplot(), @@ -166,25 +157,18 @@ ggcoefstats <- function(x, if (insight::is_model(x)) { statistic <- insight::find_statistic(x) - eta_squared <- omega_squared <- NULL - if (effsize == "eta") eta_squared <- "partial" - if (effsize == "omega") omega_squared <- "partial" - # converting model object to a tidy data frame - tidy_df <- parameters::model_parameters( - model = x, - eta_squared = eta_squared, - omega_squared = omega_squared, - ci = conf.level, - verbose = FALSE, - table_wide = TRUE, + tidy_df <- tidy_model_parameters( + model = x, + effectsize_type = effectsize.type, + ci = conf.level, + table_wide = TRUE, ... ) %>% - parameters::standardize_names(style = "broom") %>% rename_all(~ gsub("omega2.|eta2.", "", .x)) # anova objects need further cleaning - if (all(c("df", "df.error") %in% names(tidy_df))) tidy_df %<>% mutate(effectsize = paste0("partial ", effsize, "-squared")) + if (all(c("df", "df.error") %in% names(tidy_df))) tidy_df %<>% mutate(effectsize = paste0("partial ", effectsize.type, "-squared")) } # tidy data frame cleanup ------------------------- @@ -233,7 +217,7 @@ ggcoefstats <- function(x, if (stats.labels) { # add expression labels - tidy_df %<>% statsExpressions::tidy_model_expressions(statistic, k, effsize) + tidy_df %<>% tidy_model_expressions(statistic, k, effectsize.type) # only significant p-value labels are shown if (only.significant && ("p.value" %in% names(tidy_df))) { diff --git a/R/ggcorrmat.R b/R/ggcorrmat.R index 7f7bda603..a34c2f002 100644 --- a/R/ggcorrmat.R +++ b/R/ggcorrmat.R @@ -185,7 +185,7 @@ ggcorrmat <- function(data, ), env = list( sig.level = sig.level, - adj.text = statsExpressions::p_adjust_text(p.adjust.method), + adj.text = p_adjust_text(p.adjust.method), top.text = caption ) ) diff --git a/R/ggstatsplot-package.R b/R/ggstatsplot-package.R index 2b39757a1..c96e6cea0 100644 --- a/R/ggstatsplot-package.R +++ b/R/ggstatsplot-package.R @@ -50,10 +50,13 @@ #' - `combine_plots()` helper function to combine multiple `{ggstatsplot}` #' plots using `patchwork::wrap_plots()`. #' +#' References: Patil (2021) \doi{10.21105/joss.03236}. +#' #' For more documentation, see the dedicated #' \href{https://indrajeetpatil.github.io/ggstatsplot/}{Website}. #' #' @docType package +#' @keywords internal #' @aliases ggstatsplot ggstatsplot-package #' @name ggstatsplot-package "_PACKAGE" diff --git a/R/ggwithinstats.R b/R/ggwithinstats.R index 768368cae..6a8b92eaa 100644 --- a/R/ggwithinstats.R +++ b/R/ggwithinstats.R @@ -76,46 +76,20 @@ ggwithinstats <- function(data, tr = 0.2, centrality.plotting = TRUE, centrality.type = type, - centrality.point.args = list( - size = 5, - color = "darkred" - ), - centrality.label.args = list( - size = 3, - nudge_x = 0.4, - segment.linetype = 4 - ), + centrality.point.args = list(size = 5, color = "darkred"), + centrality.label.args = list(size = 3, nudge_x = 0.4, segment.linetype = 4), centrality.path = TRUE, - centrality.path.args = list( - size = 1, - color = "red", - alpha = 0.5 - ), - point.args = list( - size = 3, - alpha = 0.5 - ), + centrality.path.args = list(size = 1, color = "red", alpha = 0.5), + point.args = list(size = 3, alpha = 0.5), point.path = TRUE, - point.path.args = list( - alpha = 0.5, - linetype = "dashed" - ), + point.path.args = list(alpha = 0.5, linetype = "dashed"), outlier.tagging = FALSE, outlier.label = NULL, outlier.coef = 1.5, outlier.label.args = list(size = 3), - boxplot.args = list( - width = 0.2, - alpha = 0.5 - ), - violin.args = list( - width = 0.5, - alpha = 0.2 - ), - ggsignif.args = list( - textsize = 3, - tip_length = 0.01 - ), + boxplot.args = list(width = 0.2, alpha = 0.5), + violin.args = list(width = 0.5, alpha = 0.2), + ggsignif.args = list(textsize = 3, tip_length = 0.01), ggtheme = ggstatsplot::theme_ggstatsplot(), package = "RColorBrewer", palette = "Dark2", diff --git a/R/reexports.R b/R/reexports.R index ffbdc17ac..768d43299 100644 --- a/R/reexports.R +++ b/R/reexports.R @@ -1,53 +1,7 @@ -# ----------------------- tidyverse ------------------------------------- - #' @export #' @importFrom statsExpressions "%>%" statsExpressions::`%>%` -#' @export -#' @importFrom statsExpressions "%<>%" -statsExpressions::`%<>%` - -#' @export -#' @importFrom statsExpressions "%$%" -statsExpressions::`%$%` - -#' @export -#' @importFrom statsExpressions "%<-%" -statsExpressions::`%<-%` - -#' @export -#' @importFrom statsExpressions tibble -statsExpressions::tibble - #' @export #' @importFrom statsExpressions pairwise_comparisons statsExpressions::pairwise_comparisons - -#' @export -#' @importFrom statsExpressions as_tibble -statsExpressions::as_tibble - -#' @export -#' @importFrom rlang exec -rlang::exec - -#' @export -#' @importFrom rlang "!!" -rlang::`!!` - -#' @export -#' @importFrom rlang "!!!" -rlang::`!!!` - -#' @export -#' @importFrom rlang "%|%" -rlang::`%|%` - -#' @export -#' @importFrom rlang "%||%" -rlang::`%||%` - -#' @export -#' @importFrom rlang ":=" -rlang::`:=` diff --git a/README.Rmd b/README.Rmd index 4e5edaf1a..2cb603602 100644 --- a/README.Rmd +++ b/README.Rmd @@ -32,12 +32,10 @@ library(ggstatsplot) ## `{ggstatsplot}`: `{ggplot2}` Based Plots with Statistical Details -Status | Usage| Miscellaneous +Status | Usage | Miscellaneous ----------------- | ----------------- | ----------------- - [![R build status](https://github.com/IndrajeetPatil/ggstatsplot/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Total downloads badge](https://cranlogs.r-pkg.org/badges/grand-total/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/ggstatsplot/branch/master/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/ggstatsplot?branch=master) -[![lints](https://github.com/IndrajeetPatil/ggstatsplot/workflows/lint/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Daily downloads badge](https://cranlogs.r-pkg.org/badges/last-day/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![status](https://tinyverse.netlify.com/badge/ggstatsplot)](https://CRAN.R-project.org/package=ggstatsplot) -[![pkgdown](https://github.com/IndrajeetPatil/ggstatsplot/workflows/pkgdown/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot/actions) | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03167/status.svg)](https://doi.org/10.21105/joss.03167) | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) - +[![R build status](https://github.com/IndrajeetPatil/ggstatsplot/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/ggstatsplot/branch/main/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/ggstatsplot?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/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03167/status.svg)](https://doi.org/10.21105/joss.03167) ## Raison d'être @@ -106,19 +104,17 @@ version of the package, see: ## Summary of available plots -It, therefore, produces a limited kinds of plots for the supported analyses: - -Function | Plot | Description | Lifecycle -------- | ---------- | ------------------------- | ---- -`ggbetweenstats` | **violin plots** | for comparisons *between* groups/conditions | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`ggwithinstats` | **violin plots** | for comparisons *within* groups/conditions | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`gghistostats` | **histograms** | for distribution about numeric variable | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`ggdotplotstats` | **dot plots/charts** | for distribution about labeled numeric variable | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`ggscatterstats` | **scatterplots** | for correlation between two variables | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`ggcorrmat` | **correlation matrices** | for correlations between multiple variables | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`ggpiestats` | **pie charts** | for categorical data | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`ggbarstats` | **bar charts** | for categorical data | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) -`ggcoefstats` | **dot-and-whisker plots** | for regression models and meta-analysis | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) +| Function | Plot | Description | +| :----------------- | :------------------------ | :---------------------------------------------- | +| `ggbetweenstats()` | **violin plots** | for comparisons *between* groups/conditions | +| `ggwithinstats()` | **violin plots** | for comparisons *within* groups/conditions | +| `gghistostats()` | **histograms** | for distribution about numeric variable | +| `ggdotplotstats()` | **dot plots/charts** | for distribution about labeled numeric variable | +| `ggscatterstats()` | **scatterplots** | for correlation between two variables | +| `ggcorrmat()` | **correlation matrices** | for correlations between multiple variables | +| `ggpiestats()` | **pie charts** | for categorical data | +| `ggbarstats()` | **bar charts** | for categorical data | +| `ggcoefstats()` | **dot-and-whisker plots** | for regression models and meta-analysis | In addition to these basic plots, `{ggstatsplot}` also provides **`grouped_`** versions (see below) that makes it easy to repeat the same analysis for @@ -131,15 +127,15 @@ supported in this package- Functions | Description | Parametric | Non-parametric | Robust | Bayesian ------- | ------------------ | ---- | ----- | ----| ----- -`ggbetweenstats` | Between group/condition comparisons | ✅ | ✅ | ✅ | ✅ -`ggwithinstats` | Within group/condition comparisons | ✅ | ✅ | ✅ | ✅ -`gghistostats`, `ggdotplotstats` | Distribution of a numeric variable | ✅ | ✅ | ✅ | ✅ +`ggbetweenstats()` | Between group/condition comparisons | ✅ | ✅ | ✅ | ✅ +`ggwithinstats()` | Within group/condition comparisons | ✅ | ✅ | ✅ | ✅ +`gghistostats()`, `ggdotplotstats()` | Distribution of a numeric variable | ✅ | ✅ | ✅ | ✅ `ggcorrmat` | Correlation matrix | ✅ | ✅ | ✅ | ✅ -`ggscatterstats` | Correlation between two variables | ✅ | ✅ | ✅ | ✅ -`ggpiestats`, `ggbarstats` | Association between categorical variables | ✅ | ✅ | ❌ | ✅ -`ggpiestats`, `ggbarstats` | Equal proportions for categorical variable levels | ✅ | ✅ | ❌ | ✅ -`ggcoefstats` | Regression model coefficients | ✅ | ✅ | ✅ | ✅ -`ggcoefstats` | Random-effects meta-analysis | ✅ | ❌ | ✅ | ✅ +`ggscatterstats()` | Correlation between two variables | ✅ | ✅ | ✅ | ✅ +`ggpiestats()`, `ggbarstats()` | Association between categorical variables | ✅ | ✅ | ❌ | ✅ +`ggpiestats()`, `ggbarstats()` | Equal proportions for categorical variable levels | ✅ | ✅ | ❌ | ✅ +`ggcoefstats()` | Regression model coefficients | ✅ | ✅ | ✅ | ✅ +`ggcoefstats()` | Random-effects meta-analysis | ✅ | ❌ | ✅ | ✅ Summary of Bayesian analysis @@ -168,7 +164,7 @@ various functions can be found in article for that package: ## Primary functions -### `ggbetweenstats` +### `ggbetweenstats()` This function creates either a violin plot, a box plot, or a mix of two for **between**-group or **between**-condition comparisons with results from @@ -286,12 +282,12 @@ Non-parametric | No | Dunn test | ✅ | `PMCMRplus::kwAllPairsDunnTest` Robust | No | Yuen's trimmed means test | ✅ | `WRS2::lincon` Bayesian | `NA` | Student's *t*-test | `NA` | `BayesFactor::ttestBF` -For more, see the `ggbetweenstats` vignette: +For more, see the `ggbetweenstats()` vignette: -### `ggwithinstats` +### `ggwithinstats()` -`ggbetweenstats` function has an identical twin function `ggwithinstats` for +`ggbetweenstats()` function has an identical twin function `ggwithinstats()` for repeated measures designs that behaves in the same fashion with a few minor tweaks introduced to properly visualize the repeated measures design. As can be seen from an example below, the only difference between the plot structure is @@ -333,7 +329,7 @@ Non-parametric | median | `datawizard::describe_distribution` Robust | trimmed mean | `datawizard::describe_distribution` Bayesian | MAP estimate | `datawizard::describe_distribution` -As with the `ggbetweenstats`, this function also has a `grouped_` variant that +As with the `ggbetweenstats()`, this function also has a `grouped_` variant that makes repeating the same analysis across a single grouping variable quicker. We will see an example with only repeated measurements- @@ -417,14 +413,14 @@ Non-parametric | Durbin-Conover test | ✅ | `PMCMRplus::durbinAllPairsTest` Robust | Yuen's trimmed means test | ✅ | `WRS2::rmmcp` Bayesian | Student's *t*-test | ❌ | `BayesFactor::ttestBF` -For more, see the `ggwithinstats` vignette: +For more, see the `ggwithinstats()` vignette: -### `gghistostats` +### `gghistostats()` To visualize the distribution of a single variable and check if its mean is significantly different from a specified value with a one-sample test, -`gghistostats` can be used. +`gghistostats()` can be used. ```{r} #| label = "gghistostats1", @@ -512,12 +508,12 @@ Robust | trimmed mean | ✅ | `WRS2::trimcibt` Bayes Factor | $\delta_{posterior}$ | ✅ | `bayestestR::describe_posterior` For more, including information about the variant of this function -`grouped_gghistostats`, see the `gghistostats` vignette: +`grouped_gghistostats()`, see the `gghistostats()` vignette: -### `ggdotplotstats` +### `ggdotplotstats()` -This function is similar to `gghistostats`, but is intended to be used when the +This function is similar to `gghistostats()`, but is intended to be used when the numeric variable also has a label. ```{r} @@ -605,7 +601,7 @@ Non-parametric | *r* (rank-biserial correlation) | ✅ | `effectsize::rank_biser Robust | trimmed mean | ✅ | `WRS2::trimcibt` Bayes Factor | $\delta_{posterior}$ | ✅ | `bayestestR::describe_posterior` -### `ggscatterstats` +### `ggscatterstats()` This function creates a scatterplot with marginal distributions overlaid on the axes and results from statistical tests in the subtitle: @@ -676,7 +672,7 @@ Non-parametric | Spearman's rank correlation coefficient | ✅ | `correlation::c Robust | Winsorized Pearson correlation coefficient | ✅ | `correlation::correlation` Bayesian | Pearson's correlation coefficient | ✅ | `correlation::correlation` -For more, see the `ggscatterstats` vignette: +For more, see the `ggscatterstats()` vignette: ### `ggcorrmat` @@ -747,7 +743,7 @@ Bayesian | Pearson's correlation coefficient | ✅ | `correlation::correlation` For examples and more information, see the `ggcorrmat` vignette: -### `ggpiestats` +### `ggpiestats()` This function creates a pie chart for categorical or nominal variables with results from contingency table analysis (Pearson's chi-squared test for @@ -850,13 +846,13 @@ Type | Effect size | CI? | Function used Parametric/Non-parametric | Pearson's $C$ | ✅ | `effectsize::pearsons_c` Bayesian | ❌ | ❌ | ❌ -For more, see the `ggpiestats` vignette: +For more, see the `ggpiestats()` vignette: -### `ggbarstats` +### `ggbarstats()` In case you are not a fan of pie charts (for very good reasons), you can -alternatively use `ggbarstats` function which has a similar syntax. +alternatively use `ggbarstats()` function which has a similar syntax. N.B. The *p*-values from one-sample proportion test are displayed on top of each bar. @@ -954,9 +950,9 @@ Type | Effect size | CI? | Function used Parametric/Non-parametric | Pearson's $C$ | ✅ | `effectsize::pearsons_c` Bayesian | ❌ | ❌ | ❌ -### `ggcoefstats` +### `ggcoefstats()` -The function `ggcoefstats` generates **dot-and-whisker plots** for +The function `ggcoefstats()` generates **dot-and-whisker plots** for regression models saved in a tidy data frame. The tidy data frames are prepared using `parameters::model_parameters()`. Additionally, if available, the model summary indices are also extracted from `performance::model_performance()`. @@ -1006,7 +1002,7 @@ ggcoefstats(mod) ##### Supported models Most of the regression models that are supported in the underlying packages are -also supported by `ggcoefstats`. +also supported by `ggcoefstats()`. ```{r} #| label = "supported" diff --git a/README.md b/README.md index ea2ea5925..699c2cc4b 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,10 @@ ## `{ggstatsplot}`: `{ggplot2}` Based Plots with Statistical Details -| Status | Usage | Miscellaneous | -|---------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [![R build status](https://github.com/IndrajeetPatil/ggstatsplot/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Total downloads badge](https://cranlogs.r-pkg.org/badges/grand-total/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/ggstatsplot/branch/master/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/ggstatsplot?branch=master) | -| [![lints](https://github.com/IndrajeetPatil/ggstatsplot/workflows/lint/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Daily downloads badge](https://cranlogs.r-pkg.org/badges/last-day/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![status](https://tinyverse.netlify.com/badge/ggstatsplot)](https://CRAN.R-project.org/package=ggstatsplot) | -| [![pkgdown](https://github.com/IndrajeetPatil/ggstatsplot/workflows/pkgdown/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot/actions) | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03167/status.svg)](https://doi.org/10.21105/joss.03167) | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | +| Status | Usage | Miscellaneous | +|---------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [![R build status](https://github.com/IndrajeetPatil/ggstatsplot/workflows/R-CMD-check/badge.svg)](https://github.com/IndrajeetPatil/ggstatsplot) | [![Total downloads](https://cranlogs.r-pkg.org/badges/grand-total/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![Codecov](https://codecov.io/gh/IndrajeetPatil/ggstatsplot/branch/main/graph/badge.svg)](https://app.codecov.io/gh/IndrajeetPatil/ggstatsplot?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/ggstatsplot?color=blue)](https://CRAN.R-project.org/package=ggstatsplot) | [![DOI](https://joss.theoj.org/papers/10.21105/joss.03167/status.svg)](https://doi.org/10.21105/joss.03167) | ## Raison d’être @@ -97,20 +96,17 @@ To see the detailed documentation for each function in the stable ## Summary of available plots -It, therefore, produces a limited kinds of plots for the supported -analyses: - -| Function | Plot | Description | Lifecycle | -|------------------|---------------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| -| `ggbetweenstats` | **violin plots** | for comparisons *between* groups/conditions | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `ggwithinstats` | **violin plots** | for comparisons *within* groups/conditions | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `gghistostats` | **histograms** | for distribution about numeric variable | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `ggdotplotstats` | **dot plots/charts** | for distribution about labeled numeric variable | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `ggscatterstats` | **scatterplots** | for correlation between two variables | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `ggcorrmat` | **correlation matrices** | for correlations between multiple variables | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `ggpiestats` | **pie charts** | for categorical data | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `ggbarstats` | **bar charts** | for categorical data | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | -| `ggcoefstats` | **dot-and-whisker plots** | for regression models and meta-analysis | [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | +| Function | Plot | Description | +|:-------------------|:--------------------------|:------------------------------------------------| +| `ggbetweenstats()` | **violin plots** | for comparisons *between* groups/conditions | +| `ggwithinstats()` | **violin plots** | for comparisons *within* groups/conditions | +| `gghistostats()` | **histograms** | for distribution about numeric variable | +| `ggdotplotstats()` | **dot plots/charts** | for distribution about labeled numeric variable | +| `ggscatterstats()` | **scatterplots** | for correlation between two variables | +| `ggcorrmat()` | **correlation matrices** | for correlations between multiple variables | +| `ggpiestats()` | **pie charts** | for categorical data | +| `ggbarstats()` | **bar charts** | for categorical data | +| `ggcoefstats()` | **dot-and-whisker plots** | for regression models and meta-analysis | In addition to these basic plots, `{ggstatsplot}` also provides **`grouped_`** versions (see below) that makes it easy to repeat the @@ -121,17 +117,17 @@ same analysis for any grouping variable. The table below summarizes all the different types of analyses currently supported in this package- -| Functions | Description | Parametric | Non-parametric | Robust | Bayesian | -|----------------------------------|---------------------------------------------------|------------|----------------|--------|----------| -| `ggbetweenstats` | Between group/condition comparisons | ✅ | ✅ | ✅ | ✅ | -| `ggwithinstats` | Within group/condition comparisons | ✅ | ✅ | ✅ | ✅ | -| `gghistostats`, `ggdotplotstats` | Distribution of a numeric variable | ✅ | ✅ | ✅ | ✅ | -| `ggcorrmat` | Correlation matrix | ✅ | ✅ | ✅ | ✅ | -| `ggscatterstats` | Correlation between two variables | ✅ | ✅ | ✅ | ✅ | -| `ggpiestats`, `ggbarstats` | Association between categorical variables | ✅ | ✅ | ❌ | ✅ | -| `ggpiestats`, `ggbarstats` | Equal proportions for categorical variable levels | ✅ | ✅ | ❌ | ✅ | -| `ggcoefstats` | Regression model coefficients | ✅ | ✅ | ✅ | ✅ | -| `ggcoefstats` | Random-effects meta-analysis | ✅ | ❌ | ✅ | ✅ | +| Functions | Description | Parametric | Non-parametric | Robust | Bayesian | +|--------------------------------------|---------------------------------------------------|------------|----------------|--------|----------| +| `ggbetweenstats()` | Between group/condition comparisons | ✅ | ✅ | ✅ | ✅ | +| `ggwithinstats()` | Within group/condition comparisons | ✅ | ✅ | ✅ | ✅ | +| `gghistostats()`, `ggdotplotstats()` | Distribution of a numeric variable | ✅ | ✅ | ✅ | ✅ | +| `ggcorrmat` | Correlation matrix | ✅ | ✅ | ✅ | ✅ | +| `ggscatterstats()` | Correlation between two variables | ✅ | ✅ | ✅ | ✅ | +| `ggpiestats()`, `ggbarstats()` | Association between categorical variables | ✅ | ✅ | ❌ | ✅ | +| `ggpiestats()`, `ggbarstats()` | Equal proportions for categorical variable levels | ✅ | ✅ | ❌ | ✅ | +| `ggcoefstats()` | Regression model coefficients | ✅ | ✅ | ✅ | ✅ | +| `ggcoefstats()` | Random-effects meta-analysis | ✅ | ❌ | ✅ | ✅ | Summary of Bayesian analysis @@ -161,7 +157,7 @@ across various functions can be found in article for that package: ## Primary functions -### `ggbetweenstats` +### `ggbetweenstats()` This function creates either a violin plot, a box plot, or a mix of two for **between**-group or **between**-condition comparisons with results @@ -277,17 +273,18 @@ Note here that the function can be used to tag outliers! | Robust | No | Yuen’s trimmed means test | ✅ | `WRS2::lincon` | | Bayesian | `NA` | Student’s *t*-test | `NA` | `BayesFactor::ttestBF` | -For more, see the `ggbetweenstats` vignette: +For more, see the `ggbetweenstats()` vignette: -### `ggwithinstats` +### `ggwithinstats()` -`ggbetweenstats` function has an identical twin function `ggwithinstats` -for repeated measures designs that behaves in the same fashion with a -few minor tweaks introduced to properly visualize the repeated measures -design. As can be seen from an example below, the only difference -between the plot structure is that now the group means are connected by -paths to highlight the fact that these data are paired with each other. +`ggbetweenstats()` function has an identical twin function +`ggwithinstats()` for repeated measures designs that behaves in the same +fashion with a few minor tweaks introduced to properly visualize the +repeated measures design. As can be seen from an example below, the only +difference between the plot structure is that now the group means are +connected by paths to highlight the fact that these data are paired with +each other. ``` r set.seed(123) @@ -320,7 +317,7 @@ The central tendency measure displayed will depend on the statistics: | Robust | trimmed mean | `datawizard::describe_distribution` | | Bayesian | MAP estimate | `datawizard::describe_distribution` | -As with the `ggbetweenstats`, this function also has a `grouped_` +As with the `ggbetweenstats()`, this function also has a `grouped_` variant that makes repeating the same analysis across a single grouping variable quicker. We will see an example with only repeated measurements- @@ -404,14 +401,14 @@ grouped_ggwithinstats( | Robust | Yuen’s trimmed means test | ✅ | `WRS2::rmmcp` | | Bayesian | Student’s *t*-test | ❌ | `BayesFactor::ttestBF` | -For more, see the `ggwithinstats` vignette: +For more, see the `ggwithinstats()` vignette: -### `gghistostats` +### `gghistostats()` To visualize the distribution of a single variable and check if its mean is significantly different from a specified value with a one-sample -test, `gghistostats` can be used. +test, `gghistostats()` can be used. ``` r set.seed(123) @@ -495,12 +492,12 @@ grouped_gghistostats( | Bayes Factor | $\delta_{posterior}$ | ✅ | `bayestestR::describe_posterior` | For more, including information about the variant of this function -`grouped_gghistostats`, see the `gghistostats` vignette: +`grouped_gghistostats()`, see the `gghistostats()` vignette: -### `ggdotplotstats` +### `ggdotplotstats()` -This function is similar to `gghistostats`, but is intended to be used +This function is similar to `gghistostats()`, but is intended to be used when the numeric variable also has a label. ``` r @@ -584,7 +581,7 @@ grouped_ggdotplotstats( | Robust | trimmed mean | ✅ | `WRS2::trimcibt` | | Bayes Factor | $\delta_{posterior}$ | ✅ | `bayestestR::describe_posterior` | -### `ggscatterstats` +### `ggscatterstats()` This function creates a scatterplot with marginal distributions overlaid on the axes and results from statistical tests in the subtitle: @@ -651,7 +648,7 @@ grouped_ggscatterstats( | Robust | Winsorized Pearson correlation coefficient | ✅ | `correlation::correlation` | | Bayesian | Pearson’s correlation coefficient | ✅ | `correlation::correlation` | -For more, see the `ggscatterstats` vignette: +For more, see the `ggscatterstats()` vignette: ### `ggcorrmat` @@ -722,7 +719,7 @@ grouped_ggcorrmat( For examples and more information, see the `ggcorrmat` vignette: -### `ggpiestats` +### `ggpiestats()` This function creates a pie chart for categorical or nominal variables with results from contingency table analysis (Pearson’s chi-squared test @@ -821,13 +818,13 @@ grouped_ggpiestats( | Parametric/Non-parametric | Pearson’s $C$ | ✅ | `effectsize::pearsons_c` | | Bayesian | ❌ | ❌ | ❌ | -For more, see the `ggpiestats` vignette: +For more, see the `ggpiestats()` vignette: -### `ggbarstats` +### `ggbarstats()` In case you are not a fan of pie charts (for very good reasons), you can -alternatively use `ggbarstats` function which has a similar syntax. +alternatively use `ggbarstats()` function which has a similar syntax. N.B. The *p*-values from one-sample proportion test are displayed on top of each bar. @@ -921,9 +918,9 @@ grouped_ggbarstats( | Parametric/Non-parametric | Pearson’s $C$ | ✅ | `effectsize::pearsons_c` | | Bayesian | ❌ | ❌ | ❌ | -### `ggcoefstats` +### `ggcoefstats()` -The function `ggcoefstats` generates **dot-and-whisker plots** for +The function `ggcoefstats()` generates **dot-and-whisker plots** for regression models saved in a tidy data frame. The tidy data frames are prepared using `parameters::model_parameters()`. Additionally, if available, the model summary indices are also extracted from @@ -974,7 +971,7 @@ ggcoefstats(mod) ##### Supported models Most of the regression models that are supported in the underlying -packages are also supported by `ggcoefstats`. +packages are also supported by `ggcoefstats()`. ``` r insight::supported_models() @@ -1006,84 +1003,86 @@ insight::supported_models() #> [51] "cpglmm" "crch" #> [53] "crq" "crqs" #> [55] "crr" "dep.effect" -#> [57] "DirichletRegModel" "drc" -#> [59] "eglm" "elm" -#> [61] "epi.2by2" "ergm" -#> [63] "feglm" "feis" -#> [65] "felm" "fitdistr" -#> [67] "fixest" "flexsurvreg" -#> [69] "gam" "Gam" -#> [71] "gamlss" "gamm" -#> [73] "gamm4" "garch" -#> [75] "gbm" "gee" -#> [77] "geeglm" "glht" -#> [79] "glimML" "glm" -#> [81] "Glm" "glmm" -#> [83] "glmmadmb" "glmmPQL" -#> [85] "glmmTMB" "glmrob" -#> [87] "glmRob" "glmx" -#> [89] "gls" "gmnl" -#> [91] "HLfit" "htest" -#> [93] "hurdle" "iv_robust" -#> [95] "ivFixed" "ivprobit" -#> [97] "ivreg" "lavaan" -#> [99] "lm" "lm_robust" -#> [101] "lme" "lmerMod" -#> [103] "lmerModLmerTest" "lmodel2" -#> [105] "lmrob" "lmRob" -#> [107] "logistf" "logitmfx" -#> [109] "logitor" "LORgee" -#> [111] "lqm" "lqmm" -#> [113] "lrm" "manova" -#> [115] "MANOVA" "marginaleffects" -#> [117] "marginaleffects.summary" "margins" -#> [119] "maxLik" "mclogit" -#> [121] "mcmc" "mcmc.list" -#> [123] "MCMCglmm" "mcp1" -#> [125] "mcp12" "mcp2" -#> [127] "med1way" "mediate" -#> [129] "merMod" "merModList" -#> [131] "meta_bma" "meta_fixed" -#> [133] "meta_random" "metaplus" -#> [135] "mhurdle" "mipo" -#> [137] "mira" "mixed" -#> [139] "MixMod" "mixor" -#> [141] "mjoint" "mle" -#> [143] "mle2" "mlm" -#> [145] "mlogit" "mmlogit" -#> [147] "model_fit" "multinom" -#> [149] "mvord" "negbinirr" -#> [151] "negbinmfx" "ols" -#> [153] "onesampb" "orm" -#> [155] "pgmm" "plm" -#> [157] "PMCMR" "poissonirr" -#> [159] "poissonmfx" "polr" -#> [161] "probitmfx" "psm" -#> [163] "Rchoice" "ridgelm" -#> [165] "riskRegression" "rjags" -#> [167] "rlm" "rlmerMod" -#> [169] "RM" "rma" -#> [171] "rma.uni" "robmixglm" -#> [173] "robtab" "rq" -#> [175] "rqs" "rqss" -#> [177] "Sarlm" "scam" -#> [179] "selection" "sem" -#> [181] "SemiParBIV" "semLm" -#> [183] "semLme" "slm" -#> [185] "speedglm" "speedlm" -#> [187] "stanfit" "stanmvreg" -#> [189] "stanreg" "summary.lm" -#> [191] "survfit" "survreg" -#> [193] "svy_vglm" "svychisq" -#> [195] "svyglm" "svyolr" -#> [197] "t1way" "tobit" -#> [199] "trimcibt" "truncreg" -#> [201] "vgam" "vglm" -#> [203] "wbgee" "wblm" -#> [205] "wbm" "wmcpAKP" -#> [207] "yuen" "yuend" -#> [209] "zcpglm" "zeroinfl" -#> [211] "zerotrunc" +#> [57] "DirichletRegModel" "draws" +#> [59] "drc" "eglm" +#> [61] "elm" "epi.2by2" +#> [63] "ergm" "feglm" +#> [65] "feis" "felm" +#> [67] "fitdistr" "fixest" +#> [69] "flexsurvreg" "gam" +#> [71] "Gam" "gamlss" +#> [73] "gamm" "gamm4" +#> [75] "garch" "gbm" +#> [77] "gee" "geeglm" +#> [79] "glht" "glimML" +#> [81] "glm" "Glm" +#> [83] "glmm" "glmmadmb" +#> [85] "glmmPQL" "glmmTMB" +#> [87] "glmrob" "glmRob" +#> [89] "glmx" "gls" +#> [91] "gmnl" "HLfit" +#> [93] "htest" "hurdle" +#> [95] "iv_robust" "ivFixed" +#> [97] "ivprobit" "ivreg" +#> [99] "lavaan" "lm" +#> [101] "lm_robust" "lme" +#> [103] "lmerMod" "lmerModLmerTest" +#> [105] "lmodel2" "lmrob" +#> [107] "lmRob" "logistf" +#> [109] "logitmfx" "logitor" +#> [111] "LORgee" "lqm" +#> [113] "lqmm" "lrm" +#> [115] "manova" "MANOVA" +#> [117] "marginaleffects" "marginaleffects.summary" +#> [119] "margins" "maxLik" +#> [121] "mblogit" "mclogit" +#> [123] "mcmc" "mcmc.list" +#> [125] "MCMCglmm" "mcp1" +#> [127] "mcp12" "mcp2" +#> [129] "med1way" "mediate" +#> [131] "merMod" "merModList" +#> [133] "meta_bma" "meta_fixed" +#> [135] "meta_random" "metaplus" +#> [137] "mhurdle" "mipo" +#> [139] "mira" "mixed" +#> [141] "MixMod" "mixor" +#> [143] "mjoint" "mle" +#> [145] "mle2" "mlm" +#> [147] "mlogit" "mmclogit" +#> [149] "mmlogit" "model_fit" +#> [151] "multinom" "mvord" +#> [153] "negbinirr" "negbinmfx" +#> [155] "ols" "onesampb" +#> [157] "orm" "pgmm" +#> [159] "plm" "PMCMR" +#> [161] "poissonirr" "poissonmfx" +#> [163] "polr" "probitmfx" +#> [165] "psm" "Rchoice" +#> [167] "ridgelm" "riskRegression" +#> [169] "rjags" "rlm" +#> [171] "rlmerMod" "RM" +#> [173] "rma" "rma.uni" +#> [175] "robmixglm" "robtab" +#> [177] "rq" "rqs" +#> [179] "rqss" "rvar" +#> [181] "Sarlm" "scam" +#> [183] "selection" "sem" +#> [185] "SemiParBIV" "semLm" +#> [187] "semLme" "slm" +#> [189] "speedglm" "speedlm" +#> [191] "stanfit" "stanmvreg" +#> [193] "stanreg" "summary.lm" +#> [195] "survfit" "survreg" +#> [197] "svy_vglm" "svychisq" +#> [199] "svyglm" "svyolr" +#> [201] "t1way" "tobit" +#> [203] "trimcibt" "truncreg" +#> [205] "vgam" "vglm" +#> [207] "wbgee" "wblm" +#> [209] "wbm" "wmcpAKP" +#> [211] "yuen" "yuend" +#> [213] "zcpglm" "zeroinfl" +#> [215] "zerotrunc" ``` Although not shown here, this function can also be used to carry out @@ -1137,31 +1136,31 @@ ggbetweenstats(mtcars, cyl, mpg) %>% #> 1 0.95 0.531 1 ncp F 32 #> #> $caption_data -#> # A tibble: 6 × 18 -#> term pd rope.percentage prior.distribution prior.location prior.scale -#> -#> 1 mu 1 0 cauchy 0 0.707 -#> 2 cyl-4 1 0 cauchy 0 0.707 -#> 3 cyl-6 0.780 0.390 cauchy 0 0.707 -#> 4 cyl-8 1 0 cauchy 0 0.707 -#> 5 sig2 1 0 cauchy 0 0.707 -#> 6 g_cyl 1 0.0155 cauchy 0 0.707 -#> bf10 method log_e_bf10 effectsize -#> -#> 1 3008850. Bayes factors for linear models 14.9 Bayesian R-squared -#> 2 3008850. Bayes factors for linear models 14.9 Bayesian R-squared -#> 3 3008850. Bayes factors for linear models 14.9 Bayesian R-squared -#> 4 3008850. Bayes factors for linear models 14.9 Bayesian R-squared -#> 5 3008850. Bayes factors for linear models 14.9 Bayesian R-squared -#> 6 3008850. Bayes factors for linear models 14.9 Bayesian R-squared -#> estimate std.dev conf.level conf.low conf.high conf.method n.obs expression -#> -#> 1 0.714 0.0503 0.95 0.574 0.788 HDI 32 -#> 2 0.714 0.0503 0.95 0.574 0.788 HDI 32 -#> 3 0.714 0.0503 0.95 0.574 0.788 HDI 32 -#> 4 0.714 0.0503 0.95 0.574 0.788 HDI 32 -#> 5 0.714 0.0503 0.95 0.574 0.788 HDI 32 -#> 6 0.714 0.0503 0.95 0.574 0.788 HDI 32 +#> # A tibble: 6 × 17 +#> term pd prior.distribution prior.location prior.scale bf10 +#> +#> 1 mu 1 cauchy 0 0.707 3008850. +#> 2 cyl-4 1 cauchy 0 0.707 3008850. +#> 3 cyl-6 0.780 cauchy 0 0.707 3008850. +#> 4 cyl-8 1 cauchy 0 0.707 3008850. +#> 5 sig2 1 cauchy 0 0.707 3008850. +#> 6 g_cyl 1 cauchy 0 0.707 3008850. +#> method log_e_bf10 effectsize estimate std.dev +#> +#> 1 Bayes factors for linear models 14.9 Bayesian R-squared 0.714 0.0503 +#> 2 Bayes factors for linear models 14.9 Bayesian R-squared 0.714 0.0503 +#> 3 Bayes factors for linear models 14.9 Bayesian R-squared 0.714 0.0503 +#> 4 Bayes factors for linear models 14.9 Bayesian R-squared 0.714 0.0503 +#> 5 Bayes factors for linear models 14.9 Bayesian R-squared 0.714 0.0503 +#> 6 Bayes factors for linear models 14.9 Bayesian R-squared 0.714 0.0503 +#> conf.level conf.low conf.high conf.method n.obs expression +#> +#> 1 0.95 0.574 0.788 HDI 32 +#> 2 0.95 0.574 0.788 HDI 32 +#> 3 0.95 0.574 0.788 HDI 32 +#> 4 0.95 0.574 0.788 HDI 32 +#> 5 0.95 0.574 0.788 HDI 32 +#> 6 0.95 0.574 0.788 HDI 32 #> #> $pairwise_comparisons_data #> # A tibble: 3 × 9 diff --git a/codemeta.json b/codemeta.json index 349e90147..7f04e6821 100644 --- a/codemeta.json +++ b/codemeta.json @@ -2,13 +2,13 @@ "@context": "https://doi.org/10.5063/schema/codemeta-2.0", "@type": "SoftwareSourceCode", "identifier": "ggstatsplot", - "description": "Extension of 'ggplot2', 'ggstatsplot' creates graphics with details from statistical tests included in the plots themselves. It provides an easier syntax to generate information-rich plots for statistical analysis of continuous (violin plots, scatterplots, histograms, dot plots, dot-and-whisker plots) or categorical (pie and bar charts) data. Currently, it supports the most common types of statistical approaches and tests: parametric, nonparametric, robust, and Bayesian versions of t-test/ANOVA, correlation analyses, contingency table analysis, meta-analysis, and regression analyses.", + "description": "Extension of 'ggplot2', 'ggstatsplot' creates graphics with details from statistical tests included in the plots themselves. It provides an easier syntax to generate information-rich plots for statistical analysis of continuous (violin plots, scatterplots, histograms, dot plots, dot-and-whisker plots) or categorical (pie and bar charts) data. Currently, it supports the most common types of statistical approaches and tests: parametric, nonparametric, robust, and Bayesian versions of t-test/ANOVA, correlation analyses, contingency table analysis, meta-analysis, and regression analyses. References: Patil (2021) <10.21105/joss.03236>.", "name": "ggstatsplot: 'ggplot2' Based Plots with Statistical Details", "relatedLink": ["https://indrajeetpatil.github.io/ggstatsplot/", "https://CRAN.R-project.org/package=ggstatsplot"], "codeRepository": "https://github.com/IndrajeetPatil/ggstatsplot", "issueTracker": "https://github.com/IndrajeetPatil/ggstatsplot/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.9.4.9000", + "version": "0.9.5", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -312,7 +312,7 @@ "@type": "SoftwareApplication", "identifier": "correlation", "name": "correlation", - "version": ">= 0.8.2", + "version": ">= 0.8.3", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -325,7 +325,7 @@ "@type": "SoftwareApplication", "identifier": "datawizard", "name": "datawizard", - "version": ">= 0.5.0", + "version": ">= 0.6.2", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -398,7 +398,7 @@ "@type": "SoftwareApplication", "identifier": "insight", "name": "insight", - "version": ">= 0.18.2", + "version": ">= 0.18.5", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -423,7 +423,7 @@ "@type": "SoftwareApplication", "identifier": "parameters", "name": "parameters", - "version": ">= 0.18.2", + "version": ">= 0.19.0", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -448,7 +448,7 @@ "@type": "SoftwareApplication", "identifier": "performance", "name": "performance", - "version": ">= 0.9.2", + "version": ">= 0.10.0", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -490,7 +490,7 @@ "@type": "SoftwareApplication", "identifier": "statsExpressions", "name": "statsExpressions", - "version": ">= 1.3.3", + "version": ">= 1.3.4", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -518,7 +518,7 @@ }, "SystemRequirements": null }, - "fileSize": "9541.423KB", + "fileSize": "9526.78KB", "citation": [ { "@type": "ScholarlyArticle", @@ -550,7 +550,7 @@ ], "releaseNotes": "https://github.com/IndrajeetPatil/ggstatsplot/blob/master/NEWS.md", "readme": "https://github.com/IndrajeetPatil/ggstatsplot/blob/main/README.md", - "contIntegration": ["https://app.codecov.io/gh/IndrajeetPatil/ggstatsplot?branch=master", "https://github.com/IndrajeetPatil/ggstatsplot/actions"], + "contIntegration": "https://app.codecov.io/gh/IndrajeetPatil/ggstatsplot?branch=main", "developmentStatus": ["https://lifecycle.r-lib.org/articles/stages.html", "https://www.repostatus.org/##active", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html", "https://lifecycle.r-lib.org/articles/stages.html"], "keywords": ["ggplot-extension", "dataviz", "r", "statistical-analysis", "visualization", "datascience", "violin-plot", "plot", "bayes-factors", "regression-models", "correlation", "correlation-matrices", "tidy-data", "effect-size", "robust-statistics", "non-parametric-statistics", "parametric", "meta-analysis", "hypothesis-testing"] } diff --git a/cran-comments.md b/cran-comments.md index afdc3996f..8435b1a54 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,7 +2,7 @@ 0 errors | 0 warnings | 0 note -- Internal housekeeping to adjust to changes in upstream dependencies. +- Fixes tests for changes in dependencies. ## revdepcheck results diff --git a/data-raw/Titanic_full.R b/data-raw/Titanic_full.R index 8f88f84fc..7c0585542 100644 --- a/data-raw/Titanic_full.R +++ b/data-raw/Titanic_full.R @@ -5,14 +5,14 @@ library(dplyr) library(purrr) # looking at the table -dplyr::glimpse(x = Titanic) +dplyr::glimpse(Titanic) # converting to tibble -tibble::as_tibble(x = Titanic) +tibble::as_tibble(Titanic) # converting data frame to full length based on count information Titanic_full <- - tibble::as_tibble(x = datasets::Titanic) %>% + tibble::as_tibble(datasets::Titanic) %>% tibble::rowid_to_column(var = "id") %>% dplyr::mutate_at( .vars = dplyr::vars("id"), diff --git a/inst/WORDLIST b/inst/WORDLIST index 82bbcde1d..0f52a6ffc 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -137,7 +137,6 @@ nz partialization patilindrajeets piechart -pkgdown posteriori pre programmatically diff --git a/man/figures/README-ggbarstats1-1.png b/man/figures/README-ggbarstats1-1.png index b9add4235..07c697d67 100644 Binary files a/man/figures/README-ggbarstats1-1.png and b/man/figures/README-ggbarstats1-1.png differ diff --git a/man/figures/README-ggbarstats2-1.png b/man/figures/README-ggbarstats2-1.png index b960f59d7..f11bc450f 100644 Binary files a/man/figures/README-ggbarstats2-1.png and b/man/figures/README-ggbarstats2-1.png differ diff --git a/man/figures/README-ggpiestats1-1.png b/man/figures/README-ggpiestats1-1.png index 550b15cc0..56a668cc7 100644 Binary files a/man/figures/README-ggpiestats1-1.png and b/man/figures/README-ggpiestats1-1.png differ diff --git a/man/ggcoefstats.Rd b/man/ggcoefstats.Rd index 8a6d03741..270771518 100644 --- a/man/ggcoefstats.Rd +++ b/man/ggcoefstats.Rd @@ -12,7 +12,7 @@ ggcoefstats( conf.level = 0.95, k = 2L, exclude.intercept = FALSE, - effsize = "eta", + effectsize.type = "eta", meta.analytic.effect = FALSE, meta.type = "parametric", bf.message = TRUE, @@ -23,8 +23,8 @@ ggcoefstats( subtitle = NULL, caption = NULL, only.significant = FALSE, - point.args = list(size = 3, color = "blue"), - errorbar.args = list(height = 0), + point.args = list(size = 3, color = "blue", na.rm = TRUE), + errorbar.args = list(height = 0, na.rm = TRUE), vline = TRUE, vline.args = list(size = 1, linetype = "dashed"), stats.labels = TRUE, @@ -37,21 +37,21 @@ ggcoefstats( ) } \arguments{ -\item{x}{A model object to be tidied, or a tidy data frame containing results -from a regression model. Function internally uses -\code{parameters::model_parameters()} to get a tidy data frame. If a data frame is -entered, it \emph{must} contain at the minimum two columns named \code{term} (names -of predictors) and \code{estimate} (corresponding estimates of coefficients or -other quantities of interest).} +\item{x}{A model object to be tidied, or a tidy data frame from a regression +model. Function internally uses \code{parameters::model_parameters()} to get a +tidy data frame. If a data frame, it \emph{must} contain at the minimum two +columns named \code{term} (names of predictors) and \code{estimate} (corresponding +estimates of coefficients or other quantities of interest).} \item{output}{Character describing the expected output from this function: -\code{"plot"} (visualization of regression coefficients) or \code{"tidy"} (tidy -data frame of results \code{parameters::model_parameters}) or \code{"glance"} (object -from \code{performance::model_performance}).} +\itemize{ +\item \code{"plot"} (visualization of regression coefficients) +\item \code{"tidy"} (tidy data frame of results \code{parameters::model_parameters()}) +\item \code{"glance"} (object from \code{performance::model_performance()}) +}} -\item{statistic}{Which statistic is to be displayed (either \code{"t"} or \code{"f"}or -\code{"z"} or \code{"chi"}) in the label. This is relevant if the \code{x} argument is a -\emph{data frame}.} +\item{statistic}{Relevant statistic for the model (\code{"t"}, \code{"f"}, \code{"z"}, or +\code{"chi"}) in the label. Relevant only if \code{x} is a \emph{data frame}.} \item{conf.int}{Logical. Decides whether to display confidence intervals as error bars (Default: \code{TRUE}).} @@ -65,9 +65,9 @@ error bars (Default: \code{TRUE}).} \item{exclude.intercept}{Logical that decides whether the intercept should be excluded from the plot (Default: \code{FALSE}).} -\item{effsize}{Character describing the effect size to be displayed: \code{"eta"} -(default) or \code{"omega"}. This argument is relevant only for models objects -with \emph{F}-statistic.} +\item{effectsize.type}{This is the same as \code{effectsize_type} argument of +\code{parameters::model_parameters()}. Defaults to \code{"eta"}, and relevant for +ANOVA-like objects.} \item{meta.analytic.effect}{Logical that decides whether subtitle for meta-analysis via linear (mixed-effects) models (default: \code{FALSE}). If @@ -164,14 +164,14 @@ For details, see: \note{ \enumerate{ \item In case you want to carry out meta-analysis, you will be asked to install -the needed packages (\code{{metafor}}, \code{{metaplus}}, or \code{{metaBMA}}) for -meta-analysis (if unavailable). +the needed packages (\code{{metafor}}, \code{{metaplus}}, or \code{{metaBMA}}) if they are +unavailable. \item All rows of regression estimates where either of the following -quantities is \code{NA} will be removed if labels are requested: \code{estimate}, -\code{statistic}, \code{p.value}. +quantities is \code{NA} will be removed if labels are requested: +\code{estimate}, \code{statistic}, \code{p.value}. \item Given the rapid pace at which new methods are added to these packages, it -is recommended that you install the GitHub versions of \code{{parameters}} and -\code{{performance}} in order to make most of this function. +is recommended that you install development versions of \code{{easystats}} +packages using the \code{install_latest()} function from \code{{easystats}}. } } \examples{ diff --git a/man/ggstatsplot-package.Rd b/man/ggstatsplot-package.Rd index 025486fb5..6636e33b7 100644 --- a/man/ggstatsplot-package.Rd +++ b/man/ggstatsplot-package.Rd @@ -46,6 +46,8 @@ displayed in the subtitle. plots using \code{patchwork::wrap_plots()}. } +References: Patil (2021) \doi{10.21105/joss.03236}. + For more documentation, see the dedicated \href{https://indrajeetpatil.github.io/ggstatsplot/}{Website}. } @@ -67,3 +69,4 @@ Other contributors: } } +\keyword{internal} diff --git a/man/reexports.Rd b/man/reexports.Rd index f1a58e257..d86bfecf2 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -4,18 +4,7 @@ \name{reexports} \alias{reexports} \alias{\%>\%} -\alias{\%<>\%} -\alias{\%$\%} -\alias{\%<-\%} -\alias{tibble} \alias{pairwise_comparisons} -\alias{as_tibble} -\alias{exec} -\alias{!!} -\alias{!!!} -\alias{\%|\%} -\alias{\%||\%} -\alias{:=} \title{Objects exported from other packages} \keyword{internal} \description{ @@ -23,8 +12,6 @@ These objects are imported from other packages. Follow the links below to see their documentation. \describe{ - \item{rlang}{\code{\link[rlang:injection-operator]{!!}}, \code{\link[rlang:splice-operator]{!!!}}, \code{\link[rlang:op-na-default]{\%|\%}}, \code{\link[rlang:op-null-default]{\%||\%}}, \code{\link[rlang:dyn-dots]{:=}}, \code{\link[rlang]{exec}}} - - \item{statsExpressions}{\code{\link[statsExpressions:reexports]{\%$\%}}, \code{\link[statsExpressions:reexports]{\%<-\%}}, \code{\link[statsExpressions:reexports]{\%<>\%}}, \code{\link[statsExpressions:reexports]{\%>\%}}, \code{\link[statsExpressions:reexports]{as_tibble}}, \code{\link[statsExpressions]{pairwise_comparisons}}, \code{\link[statsExpressions:reexports]{tibble}}} + \item{statsExpressions}{\code{\link[statsExpressions:reexports]{\%>\%}}, \code{\link[statsExpressions]{pairwise_comparisons}}} }} diff --git a/old/ggcoefstats_old.Rmd b/old/ggcoefstats_old.Rmd index fa3ea7ac7..3716e5fa4 100644 --- a/old/ggcoefstats_old.Rmd +++ b/old/ggcoefstats_old.Rmd @@ -399,7 +399,6 @@ mod_aov <- stats::aov(formula = rating ~ mpaa * genre, data = movies_long) # plot ggcoefstats( x = mod_aov, - effsize = "omega", # changing the effect size estimate being displayed point.args = list(color = "red", size = 4, shape = 15), # changing the point geom package = "dutchmasters", # package from which color palette is to be taken palette = "milkmaid", # color palette for labels diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 24ffd7cca..9ca9d6172 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -57,11 +57,6 @@ reference: contents: - starts_with("grouped_") - - title: Reexported functions - desc: Useful functions re-exported from other packages. - contents: - - tibble - - title: Helper functions desc: Statistics and graphics-related helpers in `ggstatsplot` contents: @@ -79,10 +74,6 @@ reference: - bugs_wide - bugs_long - - title: Package information - contents: - - ggstatsplot-package - articles: - title: Primary functions diff --git a/tests/testthat.R b/tests/testthat.R index 892d82f04..e6fd2286e 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,5 +1,10 @@ library(testthat) library(ggstatsplot) -library(statsExpressions) + +# suppress printing environment name (noisy) +invisible({ + loadNamespace("statsExpressions") + loadNamespace("vdiffr") +}) test_check("ggstatsplot") diff --git a/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-with-na.svg b/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-with-na.svg index c62dcfba5..4c683b18f 100644 --- a/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-with-na.svg +++ b/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-with-na.svg @@ -225,7 +225,7 @@ Cramer posterior = -0.29 +0.00 , C @@ -236,10 +236,10 @@ I [ -0.20 +0.00 , -0.40 +0.26 ] , diff --git a/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-without-na.svg b/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-without-na.svg index d8ee74502..a4e1559ed 100644 --- a/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-without-na.svg +++ b/tests/testthat/_snaps/ggbarstats/checking-unpaired-two-way-table-without-na.svg @@ -176,7 +176,7 @@ Cramer posterior = -0.48 +0.41 , C @@ -187,10 +187,10 @@ I [ -0.20 +0.00 , -0.71 +0.68 ] , diff --git a/tests/testthat/_snaps/ggcoefstats.md b/tests/testthat/_snaps/ggcoefstats.md index cce5cd586..445b47af4 100644 --- a/tests/testthat/_snaps/ggcoefstats.md +++ b/tests/testthat/_snaps/ggcoefstats.md @@ -8,15 +8,15 @@ list(tidy_df, glance_df) Output [[1]] - # A tibble: 2 x 10 + # A tibble: 2 x 11 term estimate std.error conf.level conf.low conf.high statistic 1 (Intercept) 6.05 0.309 0.95 5.42 6.68 19.6 2 mpg -0.141 0.0147 0.95 -0.171 -0.111 -9.56 - df.error p.value expression - - 1 30 1.20e-18 - 2 30 1.29e-10 + df.error p.value conf.method expression + + 1 30 1.20e-18 Wald + 2 30 1.29e-10 Wald [[2]] # A tibble: 1 x 7 diff --git a/tests/testthat/_snaps/ggcoefstats/works-when-cis-are-missing.svg b/tests/testthat/_snaps/ggcoefstats/cis-missing.svg similarity index 100% rename from tests/testthat/_snaps/ggcoefstats/works-when-cis-are-missing.svg rename to tests/testthat/_snaps/ggcoefstats/cis-missing.svg diff --git a/tests/testthat/_snaps/ggcoefstats/f-statistic-with-partial-effect-size.svg b/tests/testthat/_snaps/ggcoefstats/f-statistic-with-omega.svg similarity index 62% rename from tests/testthat/_snaps/ggcoefstats/f-statistic-with-partial-effect-size.svg rename to tests/testthat/_snaps/ggcoefstats/f-statistic-with-omega.svg index 8e660d3a6..bbf2286ed 100644 --- a/tests/testthat/_snaps/ggcoefstats/f-statistic-with-partial-effect-size.svg +++ b/tests/testthat/_snaps/ggcoefstats/f-statistic-with-omega.svg @@ -39,91 +39,91 @@ - - - + + + - - + + - - + + - - - - -η -p -2 - -= -0.81 -, - -F -( -1 -, - -28 -) -= -118.89 -, - -p -= -1.38e-11 - -η -p -2 - -= -0.21 -, - -F -( -1 -, - -28 -) -= -7.30 -, - -p -= -0.01 - -η -p -2 - -= -0.12 -, - -F -( -1 -, - -28 -) -= -3.73 -, - -p -= -0.06 + + + + +ω +p +2 + += +0.79 +, + +F +( +1 +, + +28 +) += +118.89 +, + +p += +1.38e-11 + +ω +p +2 + += +0.16 +, + +F +( +1 +, + +28 +) += +7.30 +, + +p += +0.01 + +ω +p +2 + += +0.08 +, + +F +( +1 +, + +28 +) += +3.73 +, + +p += +0.06 mpg diff --git a/tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg b/tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg new file mode 100644 index 000000000..7932e75df --- /dev/null +++ b/tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +term_1 +term_2 +term_3 +term_4 +term_5 + + + + + + + + + +0.0 +0.3 +0.6 +0.9 +estimate +term +z += +2.17 +, + +p += +0.03 +, + +β + +summary +meta += +0.44 +, + +C +I +95% + +[ +0.04 +, + +0.83 +] +, + +n +effects += +5 +l +o +g +e +( +B +F +01 +) += +-0.44 +, + +δ + +difference +posterior += +0.39 +, + +C +I +95% +E +T +I + +[ +-0.02 +, + +0.81 +] +, + +r +Cauchy +JZS += +0.71 + + diff --git a/tests/testthat/_snaps/ggcoefstats/nas-in-numeric-columns.svg b/tests/testthat/_snaps/ggcoefstats/nas-in-numeric-columns.svg new file mode 100644 index 000000000..0c3b20fd6 --- /dev/null +++ b/tests/testthat/_snaps/ggcoefstats/nas-in-numeric-columns.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +β + += +251.41 +, + +t +( +174 +) += +36.84 +, + +p += +4.37e-84 + +β + += +10.47 +, + +t +( +174 +) += +6.77 +, + +p += +1.88e-10 + + +(Intercept) +Days +SD (Intercept) +SD (Days) +Cor (Intercept~Days) +SD (Observations) + + + + + + + + + +0 +100 +200 +estimate +term +A +I +C += +1756 +, + +B +I +C += +1775 + + diff --git a/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-with-na.svg b/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-with-na.svg index 364315e0b..aad7f8f29 100644 --- a/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-with-na.svg +++ b/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-with-na.svg @@ -324,7 +324,7 @@ Cramer posterior = -0.29 +0.00 , C @@ -335,10 +335,10 @@ I [ -0.20 +0.00 , -0.40 +0.26 ] , diff --git a/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-without-na.svg b/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-without-na.svg index 1dce60282..b949cea8c 100644 --- a/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-without-na.svg +++ b/tests/testthat/_snaps/ggpiestats/checking-unpaired-two-way-table-without-na.svg @@ -239,7 +239,7 @@ Cramer posterior = -0.48 +0.41 , C @@ -250,10 +250,10 @@ I [ -0.20 +0.00 , -0.71 +0.68 ] , diff --git a/tests/testthat/_snaps/grouped_ggbarstats/grouped-ggbarstats-with-two-way-table.svg b/tests/testthat/_snaps/grouped_ggbarstats/grouped-ggbarstats-with-two-way-table.svg index a5605318e..c1a8aa193 100644 --- a/tests/testthat/_snaps/grouped_ggbarstats/grouped-ggbarstats-with-two-way-table.svg +++ b/tests/testthat/_snaps/grouped_ggbarstats/grouped-ggbarstats-with-two-way-table.svg @@ -166,7 +166,7 @@ Cramer posterior = -0.22 +0.00 , C @@ -177,10 +177,10 @@ I [ -0.04 +0.00 , -0.52 +0.47 ] , diff --git a/tests/testthat/_snaps/grouped_ggpiestats/grouped-ggpiestats-with-two-way-table.svg b/tests/testthat/_snaps/grouped_ggpiestats/grouped-ggpiestats-with-two-way-table.svg index 736b6bb94..32e5848c9 100644 --- a/tests/testthat/_snaps/grouped_ggpiestats/grouped-ggpiestats-with-two-way-table.svg +++ b/tests/testthat/_snaps/grouped_ggpiestats/grouped-ggpiestats-with-two-way-table.svg @@ -197,7 +197,7 @@ Cramer posterior = -0.22 +0.00 , C @@ -208,10 +208,10 @@ I [ -0.04 +0.00 , -0.52 +0.47 ] , diff --git a/tests/testthat/test-combine_plots.R b/tests/testthat/test-combine_plots.R index 935510b26..5f5213f85 100644 --- a/tests/testthat/test-combine_plots.R +++ b/tests/testthat/test-combine_plots.R @@ -1,7 +1,6 @@ test_that( desc = "checking if combining plots works", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") diff --git a/tests/testthat/test-ggbarstats.R b/tests/testthat/test-ggbarstats.R index dbae62f51..c5b59483d 100644 --- a/tests/testthat/test-ggbarstats.R +++ b/tests/testthat/test-ggbarstats.R @@ -18,7 +18,6 @@ survey_data_NA <- dplyr::tibble( test_that( desc = "checking default outputs", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -62,7 +61,6 @@ test_that( test_that( desc = "changing labels and aesthetics", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -164,7 +162,6 @@ test_that( test_that( desc = "edge cases", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -201,7 +198,7 @@ test_that( ) set.seed(123) - stats_output <- suppressWarnings(statsExpressions::contingency_table( + stats_output <- suppressWarnings(contingency_table( data = ggplot2::msleep, x = conservation, y = vore, diff --git a/tests/testthat/test-ggbetweenstats.R b/tests/testthat/test-ggbetweenstats.R index 40feb78f9..e83d77d31 100644 --- a/tests/testthat/test-ggbetweenstats.R +++ b/tests/testthat/test-ggbetweenstats.R @@ -5,7 +5,6 @@ test_that( desc = "plotting features work as expected", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -69,7 +68,6 @@ test_that( test_that( desc = "checking if `plot.type` argument works", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -123,7 +121,7 @@ test_that( ) set.seed(123) - sub <- statsExpressions::two_sample_test( + sub <- two_sample_test( data = df, x = am, y = wt diff --git a/tests/testthat/test-ggcoefstats.R b/tests/testthat/test-ggcoefstats.R index a9a3f0609..4be6dad59 100644 --- a/tests/testthat/test-ggcoefstats.R +++ b/tests/testthat/test-ggcoefstats.R @@ -1,12 +1,6 @@ -testthat::skip_on_cran() - -df_meta <- structure( - list( - estimate = c(0.111, 0.245, 0.8, 1.1, 0.03), - std.error = c(0.05, 0.111, 0.001, 0.2, 0.01) - ), - row.names = c(NA, -5L), - class = c("tbl_df", "tbl", "data.frame") +df_meta <- tibble( + estimate = c(0.111, 0.245, 0.8, 1.1, 0.03), + std.error = c(0.05, 0.111, 0.001, 0.2, 0.01) ) # errors ------------------------------------------ @@ -18,9 +12,7 @@ test_that("ggcoefstats doesn't work if no estimate column found", { # default plots for each statistic ------------------------------------------ test_that("default plots are rendered correctly for each type of statistic", { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") - skip_if_not_installed("survival") library(survival) @@ -39,8 +31,8 @@ test_that("default plots are rendered correctly for each type of statistic", { set.seed(123) vdiffr::expect_doppelganger( - title = "F-statistic with partial effect size", - fig = ggcoefstats(stats::aov(wt ~ mpg * am, mtcars), effsize = "eta", partial = TRUE) + title = "F-statistic with omega", + fig = ggcoefstats(stats::aov(wt ~ mpg * am, mtcars), effectsize.type = "omega") ) set.seed(123) @@ -68,32 +60,25 @@ test_that("default plots are rendered correctly for each type of statistic", { }) test_that("meta-analysis works", { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") - - skip_if_not_installed("survival") - skip_if_not_installed("metaBMA") skip_if_not_installed("metafor") + skip_on_os(c("windows", "linux", "solaris")) - expect_s3_class( - suppressWarnings(ggcoefstats( - df_meta, - meta.analytic.effect = TRUE, - bf.message = TRUE - )), - "ggplot" - ) + set.seed(123) + p_meta <- suppressWarnings(ggcoefstats( + df_meta, + meta.analytic.effect = TRUE, + bf.message = TRUE + )) - # TODO: generate from windows - # set.seed(123) - # vdiffr::expect_doppelganger( - # title = "meta-analysis works", - # fig = ggcoefstats( - # df_meta, - # meta.analytic.effect = TRUE, - # bf.message = TRUE - # ) - # ) + expect_s3_class(p_meta, "ggplot") + + skip_on_os("mac", c("i386", "x86_64")) + set.seed(123) + vdiffr::expect_doppelganger( + title = "meta-analysis works", + fig = p_meta + ) }) # plot modifications-------------------------------------------------- @@ -101,10 +86,8 @@ test_that("meta-analysis works", { test_that( desc = "plot modifications work as expected", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") - set.seed(123) mod1 <- stats::lm(data = mtcars, formula = wt ~ mpg * am) @@ -136,7 +119,7 @@ test_that( x = mod2, exclude.intercept = FALSE, sort = "ascending", - effsize = "omega", + effectsize.type = "omega", title = "mammalian sleep", subtitle = "Source: `{ggplot2}` package", package = "wesanderson", @@ -167,27 +150,30 @@ test_that( # edge cases ------------------------------------- -# TODO: turn it on later -# test_that( -# desc = "works when NAs present in numeric columns", -# code = { -# skip_if_not_installed("vdiffr") -# skip_if(getRversion() < "4.1") -# skip_if_not_installed("lme4") -# -# library(lme4, warn.conflicts = FALSE) -# -# set.seed(123) -# vdiffr::expect_doppelganger( -# title = "works when NAs present in numeric columns", -# fig = ggcoefstats(lmer(Reaction ~ Days + (Days | Subject), sleepstudy)) -# ) -# }) +test_that( + desc = "missing values in numeric columns", + code = { + skip_if(getRversion() < "4.1") + skip_if_not_installed("lme4") + skip_on_os(c("windows", "linux", "solaris")) + + library(lme4, warn.conflicts = FALSE) + m_lmer <- ggcoefstats(lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy)) + + expect_s3_class(m_lmer, "ggplot") + + skip_on_os("mac", c("i386", "x86_64")) + set.seed(123) + vdiffr::expect_doppelganger( + title = "NAs in numeric columns", + fig = m_lmer + ) + } +) test_that( desc = "edge cases", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") set.seed(123) @@ -195,7 +181,7 @@ test_that( set.seed(123) vdiffr::expect_doppelganger( - title = "works when CIs are missing", + title = "CIs missing", fig = ggcoefstats(dplyr::select(df_base, -dplyr::matches("conf")), statistic = "t") ) @@ -214,16 +200,10 @@ test_that( desc = "meta analysis subtitle and caption", code = { set.seed(123) - subtitle_expr <- suppressWarnings(statsExpressions::meta_analysis( - data = df_meta, - type = "p" - )) + subtitle_expr <- suppressWarnings(meta_analysis(df_meta, type = "p")) set.seed(123) - caption_expr <- suppressWarnings(statsExpressions::meta_analysis( - data = df_meta, - type = "bayes" - )) + caption_expr <- suppressWarnings(meta_analysis(df_meta, type = "bayes")) set.seed(123) ggcoef_subtitle <- suppressWarnings(ggcoefstats( diff --git a/tests/testthat/test-ggcorrmat.R b/tests/testthat/test-ggcorrmat.R index 2b1d8cf05..4982ba819 100644 --- a/tests/testthat/test-ggcorrmat.R +++ b/tests/testthat/test-ggcorrmat.R @@ -3,7 +3,6 @@ test_that( desc = "checking ggcorrmat with entier dataset", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("ggcorrplot") @@ -39,7 +38,6 @@ test_that( test_that( desc = "ggcorrmat works as expected with changed defaults", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("ggcorrplot") diff --git a/tests/testthat/test-ggdotplotstats.R b/tests/testthat/test-ggdotplotstats.R index 402c1bbd1..9db10d436 100644 --- a/tests/testthat/test-ggdotplotstats.R +++ b/tests/testthat/test-ggdotplotstats.R @@ -20,7 +20,6 @@ morley_new[87, 3] <- NA_integer_ test_that( desc = "checking default outputs", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -44,7 +43,6 @@ test_that( test_that( desc = "modification with ggplot2 works as expected", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") diff --git a/tests/testthat/test-gghistostats.R b/tests/testthat/test-gghistostats.R index 98ce5d4cd..bdc987c52 100644 --- a/tests/testthat/test-gghistostats.R +++ b/tests/testthat/test-gghistostats.R @@ -3,7 +3,6 @@ test_that( desc = "checking default outputs", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -85,7 +84,7 @@ test_that( ) set.seed(123) - sub <- statsExpressions::one_sample_test( + sub <- one_sample_test( data = ggplot2::msleep, x = brainwt, type = "np", diff --git a/tests/testthat/test-ggpiestats.R b/tests/testthat/test-ggpiestats.R index c60ac131a..01efacd74 100644 --- a/tests/testthat/test-ggpiestats.R +++ b/tests/testthat/test-ggpiestats.R @@ -18,7 +18,6 @@ survey_data_NA <- dplyr::tibble( test_that( desc = "checking default outputs", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -74,7 +73,6 @@ test_that( test_that( desc = "changing labels and aesthetics", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -176,7 +174,6 @@ test_that( test_that( desc = "edge cases", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") # dropped level dataset @@ -212,7 +209,7 @@ test_that( ) set.seed(123) - stats_output <- suppressWarnings(statsExpressions::contingency_table( + stats_output <- suppressWarnings(contingency_table( data = ggplot2::msleep, x = conservation, y = vore, diff --git a/tests/testthat/test-ggscatterstats.R b/tests/testthat/test-ggscatterstats.R index 54ee6d7d5..6b11c8278 100644 --- a/tests/testthat/test-ggscatterstats.R +++ b/tests/testthat/test-ggscatterstats.R @@ -3,7 +3,6 @@ test_that( desc = "checking ggscatterstats with entire dataset", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("ggside") @@ -27,7 +26,6 @@ test_that( test_that( desc = "aesthetic modifications work", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("ggside") @@ -55,7 +53,6 @@ test_that( ) test_that("labeling variables and expressions work as expected", { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("ggside") @@ -120,7 +117,7 @@ test_that( ) set.seed(123) - fun_sub <- statsExpressions::corr_test( + fun_sub <- corr_test( data = dplyr::starwars, x = mass, y = height, diff --git a/tests/testthat/test-ggwithinstats.R b/tests/testthat/test-ggwithinstats.R index d0e6e5560..f40809220 100644 --- a/tests/testthat/test-ggwithinstats.R +++ b/tests/testthat/test-ggwithinstats.R @@ -8,7 +8,6 @@ data_bugs_2 <- dplyr::filter(bugs_long, subject <= 30, condition %in% c("HDLF", test_that( desc = "defaults plots", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("PMCMRplus") @@ -55,7 +54,6 @@ test_that( test_that( desc = "aesthetic modifications work", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("PMCMRplus") diff --git a/tests/testthat/test-grouped_ggbarstats.R b/tests/testthat/test-grouped_ggbarstats.R index 018ae12af..fd6fcac2a 100644 --- a/tests/testthat/test-grouped_ggbarstats.R +++ b/tests/testthat/test-grouped_ggbarstats.R @@ -8,7 +8,6 @@ test_that( test_that( desc = "grouped_ggbarstats works", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") # creating a smaller data frame @@ -39,7 +38,6 @@ test_that( test_that( desc = "edge case behavior", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") diff --git a/tests/testthat/test-grouped_ggbetweenstats.R b/tests/testthat/test-grouped_ggbetweenstats.R index 4d254b86c..2a22277f5 100644 --- a/tests/testthat/test-grouped_ggbetweenstats.R +++ b/tests/testthat/test-grouped_ggbetweenstats.R @@ -3,7 +3,6 @@ test_that( desc = "grouped_ggbetweenstats defaults", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("PMCMRplus") diff --git a/tests/testthat/test-grouped_ggcorrmat.R b/tests/testthat/test-grouped_ggcorrmat.R index 4b991e20a..881e14cc0 100644 --- a/tests/testthat/test-grouped_ggcorrmat.R +++ b/tests/testthat/test-grouped_ggcorrmat.R @@ -3,7 +3,6 @@ test_that( desc = "grouped_ggcorrmat plots are as expected", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("ggcorrplot") diff --git a/tests/testthat/test-grouped_ggdotplotstats.R b/tests/testthat/test-grouped_ggdotplotstats.R index a6f84577a..83b6a2add 100644 --- a/tests/testthat/test-grouped_ggdotplotstats.R +++ b/tests/testthat/test-grouped_ggdotplotstats.R @@ -6,7 +6,7 @@ test_that( # removing factor level with very few no. of observations df <- dplyr::filter(ggplot2::mpg, cyl %in% c("4", "6", "8")) - skip_if_not_installed("vdiffr") + skip_if(getRversion() < "4.1") diff --git a/tests/testthat/test-grouped_gghistostats.R b/tests/testthat/test-grouped_gghistostats.R index ed1420658..ad4e63b44 100644 --- a/tests/testthat/test-grouped_gghistostats.R +++ b/tests/testthat/test-grouped_gghistostats.R @@ -47,7 +47,7 @@ test_that( ) set.seed(123) - basic_results <- statsExpressions::one_sample_test( + basic_results <- one_sample_test( data = df, x = brainwt, test.value = 0.25 diff --git a/tests/testthat/test-grouped_ggpiestats.R b/tests/testthat/test-grouped_ggpiestats.R index 7a46b3df3..74a244f96 100644 --- a/tests/testthat/test-grouped_ggpiestats.R +++ b/tests/testthat/test-grouped_ggpiestats.R @@ -8,7 +8,6 @@ test_that( test_that( desc = "grouped_ggpiestats works", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") @@ -50,7 +49,6 @@ test_that( test_that( desc = "edge case behavior", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") diff --git a/tests/testthat/test-grouped_ggscatterstats.R b/tests/testthat/test-grouped_ggscatterstats.R index 2a41100c7..69c1b51bc 100644 --- a/tests/testthat/test-grouped_ggscatterstats.R +++ b/tests/testthat/test-grouped_ggscatterstats.R @@ -1,7 +1,6 @@ test_that( desc = "grouped_ggscatterstats plotting works as expected", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("ggside") @@ -54,7 +53,7 @@ test_that( ) set.seed(123) - basic_results <- statsExpressions::corr_test( + basic_results <- corr_test( data = df, x = rating, y = length, diff --git a/tests/testthat/test-grouped_ggwithinstats.R b/tests/testthat/test-grouped_ggwithinstats.R index 18f4313a7..b62e2670d 100644 --- a/tests/testthat/test-grouped_ggwithinstats.R +++ b/tests/testthat/test-grouped_ggwithinstats.R @@ -3,7 +3,6 @@ test_that( desc = "default plotting as expected", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("PMCMRplus") diff --git a/tests/testthat/test-pairwise_ggsignif.R b/tests/testthat/test-pairwise_ggsignif.R index 1c9d73184..7a9e1dc22 100644 --- a/tests/testthat/test-pairwise_ggsignif.R +++ b/tests/testthat/test-pairwise_ggsignif.R @@ -3,7 +3,6 @@ test_that( desc = "check pairwise displays - between-subjects", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("PMCMRplus") @@ -133,7 +132,6 @@ test_that( test_that( desc = "check pairwise displays - within-subjects", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("PMCMRplus") @@ -264,7 +262,6 @@ test_that( test_that( desc = "adding caption works", code = { - skip_if_not_installed("vdiffr") skip_if(getRversion() < "4.1") skip_if_not_installed("PMCMRplus") diff --git a/vignettes/web_only/ggbetweenstats.Rmd b/vignettes/web_only/ggbetweenstats.Rmd index e32c84ca8..7189d96eb 100644 --- a/vignettes/web_only/ggbetweenstats.Rmd +++ b/vignettes/web_only/ggbetweenstats.Rmd @@ -15,7 +15,11 @@ vignette: > #| label = "setup", #| include = FALSE ## show me all columns -options(tibble.width = Inf, pillar.bold = TRUE, pillar.subtle_num = TRUE) +options( + tibble.width = Inf, + pillar.bold = TRUE, + pillar.subtle_num = TRUE +) knitr::opts_chunk$set( collapse = TRUE, @@ -78,7 +82,7 @@ Let's have a look at the data- #| label = "gapminder" library(gapminder) -dplyr::glimpse(x = gapminder::gapminder) +dplyr::glimpse(gapminder::gapminder) ``` **Note**: For the remainder of the vignette, we're going to exclude *Oceania* @@ -422,8 +426,6 @@ reported statistics. For example, let's see the following example: - - ```{r} #| label = "reporting" ggbetweenstats(ToothGrowth, supp, len) diff --git a/vignettes/web_only/ggcoefstats.Rmd b/vignettes/web_only/ggcoefstats.Rmd index bfe5f1747..0d32b5243 100644 --- a/vignettes/web_only/ggcoefstats.Rmd +++ b/vignettes/web_only/ggcoefstats.Rmd @@ -287,7 +287,7 @@ mod_aov <- stats::aov(formula = rating ~ mpaa * genre, data = movies_long) # plot ggcoefstats( x = mod_aov, - effsize = "omega", # changing the effect size estimate being displayed + effectsize.type = "omega", # changing the effect size estimate being displayed point.args = list(color = "red", size = 4, shape = 15), # changing the point geom package = "dutchmasters", # package from which color palette is to be taken palette = "milkmaid", # color palette for labels @@ -420,7 +420,7 @@ combine_plots( ggcoefstats(mod2, title = "independent t-test"), ggcoefstats(mod3, title = "paired t-test"), ggcoefstats(mod4, title = "correlation"), - ggcoefstats(mod5, title = "contingency table"), + ggcoefstats(mod5, title = "contingency table", effectsize.type = "cramers_v"), ggcoefstats(mod6, title = "anova"), ggcoefstats(mod7, title = "regression-1"), ggcoefstats(mod8, title = "meta-analysis"),