diff --git a/.github/workflows/R-CMD-check-hard.yaml b/.github/workflows/R-CMD-check-hard.yaml index 17549842e..ee9c7f301 100644 --- a/.github/workflows/R-CMD-check-hard.yaml +++ b/.github/workflows/R-CMD-check-hard.yaml @@ -29,7 +29,7 @@ jobs: # https://github.com/jgm/pandoc/releases - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/R-CMD-check-strict.yaml b/.github/workflows/R-CMD-check-strict.yaml index 89f4f779d..92e0554ec 100644 --- a/.github/workflows/R-CMD-check-strict.yaml +++ b/.github/workflows/R-CMD-check-strict.yaml @@ -38,7 +38,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f13d3bd3d..167c9e4f0 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -42,7 +42,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/check-all-examples.yaml b/.github/workflows/check-all-examples.yaml index 71970f7e0..a0f3893ab 100644 --- a/.github/workflows/check-all-examples.yaml +++ b/.github/workflows/check-all-examples.yaml @@ -40,6 +40,7 @@ jobs: extra-packages: | any::devtools local::. + needs: check - name: Run examples run: | diff --git a/.github/workflows/check-link-rot.yaml b/.github/workflows/check-link-rot.yaml index 83d2e93be..5db14bd13 100644 --- a/.github/workflows/check-link-rot.yaml +++ b/.github/workflows/check-link-rot.yaml @@ -21,7 +21,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: @@ -36,6 +36,7 @@ jobs: extra-packages: | any::rcmdcheck any::urlchecker + needs: check - name: Run URL checker run: | diff --git a/.github/workflows/check-random-test-order.yaml b/.github/workflows/check-random-test-order.yaml index f05ba2fde..70b68ff0d 100644 --- a/.github/workflows/check-random-test-order.yaml +++ b/.github/workflows/check-random-test-order.yaml @@ -26,6 +26,7 @@ jobs: pak-version: devel extra-packages: | local::. + needs: check - name: Run Tests in Random Order run: | diff --git a/.github/workflows/check-readme.yaml b/.github/workflows/check-readme.yaml index 277b09572..1257b3c56 100644 --- a/.github/workflows/check-readme.yaml +++ b/.github/workflows/check-readme.yaml @@ -32,7 +32,7 @@ jobs: # https://github.com/jgm/pandoc/releases - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/check-spelling.yaml b/.github/workflows/check-spelling.yaml index 1c3d0fe6c..815cb620f 100644 --- a/.github/workflows/check-spelling.yaml +++ b/.github/workflows/check-spelling.yaml @@ -21,7 +21,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/check-test-warnings.yaml b/.github/workflows/check-test-warnings.yaml index 41ad06a77..5bb9f855c 100644 --- a/.github/workflows/check-test-warnings.yaml +++ b/.github/workflows/check-test-warnings.yaml @@ -28,6 +28,7 @@ jobs: extra-packages: | local::. any::devtools + needs: check - name: Run Tests run: | diff --git a/.github/workflows/check-vignette-warnings.yaml b/.github/workflows/check-vignette-warnings.yaml index 04086c73b..1a7a8716b 100644 --- a/.github/workflows/check-vignette-warnings.yaml +++ b/.github/workflows/check-vignette-warnings.yaml @@ -18,7 +18,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: @@ -31,6 +31,7 @@ jobs: pak-version: devel extra-packages: | local::. + needs: check - name: Build vignettes run: | diff --git a/.github/workflows/lint-changed-files.yaml b/.github/workflows/lint-changed-files.yaml index 5a68017e2..39991914b 100644 --- a/.github/workflows/lint-changed-files.yaml +++ b/.github/workflows/lint-changed-files.yaml @@ -23,8 +23,6 @@ jobs: extra-packages: | any::gh r-lib/lintr - any::purrr - needs: check - name: Install package run: R CMD INSTALL . diff --git a/.github/workflows/pkgdown-no-suggests.yaml b/.github/workflows/pkgdown-no-suggests.yaml index ba180df25..f5442892f 100644 --- a/.github/workflows/pkgdown-no-suggests.yaml +++ b/.github/workflows/pkgdown-no-suggests.yaml @@ -27,7 +27,7 @@ jobs: # https://github.com/jgm/pandoc/releases - uses: r-lib/actions/setup-pandoc@v2 with: - pandoc-version: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 062ec8e16..d4c0dcaee 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: "3.1.6.1" + pandoc-version: "3.1.8" - uses: r-lib/actions/setup-r@v2 with: @@ -37,6 +37,7 @@ jobs: pak-version: devel extra-packages: | r-lib/pkgdown + r-lib/vdiffr local::. needs: website diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index f6529b125..78e3cf30d 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -27,7 +27,7 @@ jobs: pak-version: devel extra-packages: | r-lib/covr - needs: coverage + needs: check - name: Test coverage run: | diff --git a/API b/API index 82ecf079f..fe538b9d3 100644 --- a/API +++ b/API @@ -6,7 +6,7 @@ combine_plots(plotlist, plotgrid.args = list(), annotation.args = list(), guides extract_caption(p) extract_stats(p, ...) extract_subtitle(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, ...) +ggbarstats(data, x, y, counts = NULL, type = "parametric", paired = FALSE, results.subtitle = TRUE, label = "percentage", label.args = list(alpha = 1, fill = "white"), sample.size.label.args = list(size = 4), 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, ...) ggbetweenstats(data, x, y, type = "parametric", 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), point.args = list(position = ggplot2::position_jitterdodge(dodge.width = 0.6), alpha = 0.4, size = 3, stroke = 0, na.rm = TRUE), boxplot.args = list(width = 0.3, alpha = 0.2, na.rm = TRUE), violin.args = list(width = 0.5, alpha = 0.2, na.rm = TRUE), ggsignif.args = list(textsize = 3, tip_length = 0.01, na.rm = TRUE), ggtheme = ggstatsplot::theme_ggstatsplot(), package = "RColorBrewer", palette = "Dark2", ggplot.component = NULL, ...) ggcoefstats(x, 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", na.rm = TRUE), errorbar.args = list(height = 0, na.rm = TRUE), vline = TRUE, vline.args = list(linewidth = 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, 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, ...) diff --git a/CITATION.cff b/CITATION.cff index 9f9a620dd..26a2edc3a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ message: 'To cite package "ggstatsplot" in publications use:' type: software license: GPL-3.0-only title: 'ggstatsplot: ''ggplot2'' Based Plots with Statistical Details' -version: 0.12.0.9000 +version: 0.12.1 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 @@ -104,13 +104,12 @@ references: email: remi.theriault@mail.mcgill.ca orcid: https://orcid.org/0000-0003-4315-6788 year: '2023' - version: '>= 0.8.4' - type: software title: datawizard abstract: 'datawizard: Easy Data Wrangling and Statistical Transformations' notes: Imports url: https://easystats.github.io/datawizard/ - repository: https://easystats.r-universe.dev + repository: https://CRAN.R-project.org/package=datawizard authors: - family-names: Patil given-names: Indrajeet @@ -137,7 +136,7 @@ references: email: brenton@wiernik.org orcid: https://orcid.org/0000-0001-9560-6336 year: '2023' - version: '>= 0.8.0' + version: '>= 0.9.0' - type: software title: dplyr abstract: 'dplyr: A Grammar of Data Manipulation' @@ -174,7 +173,6 @@ references: given-names: Alboukadel email: alboukadel.kassambara@gmail.com year: '2023' - version: '>= 0.1.4.1' - type: software title: ggplot2 abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics' @@ -274,7 +272,7 @@ references: abstract: 'insight: Easy Access to Model Information for Various Model Objects' notes: Imports url: https://easystats.github.io/insight/ - repository: https://CRAN.R-project.org/package=insight + repository: https://easystats.r-universe.dev authors: - family-names: Lüdecke given-names: Daniel @@ -309,7 +307,7 @@ references: email: etienne.bacher@protonmail.com orcid: https://orcid.org/0000-0002-9271-5075 year: '2023' - version: '>= 0.19.4' + version: '>= 0.19.5' - type: software title: paletteer abstract: 'paletteer: Comprehensive Collection of Color Palettes' @@ -351,7 +349,7 @@ references: email: brenton@wiernik.org orcid: https://orcid.org/0000-0001-9560-6336 year: '2023' - version: '>= 0.21.1' + version: '>= 0.21.2' - type: software title: patchwork abstract: 'patchwork: The Composer of Plots' @@ -369,7 +367,7 @@ references: abstract: 'performance: Assessment of Regression Models Performance' notes: Imports url: https://easystats.github.io/performance/ - repository: https://CRAN.R-project.org/package=performance + repository: https://easystats.r-universe.dev authors: - family-names: Lüdecke given-names: Daniel @@ -449,8 +447,8 @@ references: given-names: Indrajeet email: patilindrajeet.science@gmail.com orcid: https://orcid.org/0000-0003-1995-6531 - year: '2023' version: '>= 1.5.2' + year: '2023' - type: software title: tidyr abstract: 'tidyr: Tidy Messy Data' @@ -574,12 +572,12 @@ references: title: metaBMA abstract: 'metaBMA: Bayesian Model Averaging for Random and Fixed Effects Meta-Analysis' notes: Suggests - url: https://github.com/danheck/metaBMA + url: https://danheck.github.io/metaBMA/ repository: https://CRAN.R-project.org/package=metaBMA authors: - family-names: Heck given-names: Daniel W. - email: dheck@uni-marburg.de + email: daniel.heck@uni-marburg.de orcid: https://orcid.org/0000-0002-6302-9252 year: '2023' - type: software @@ -739,6 +737,30 @@ references: email: lise.vaudor@ens-lyon.fr year: '2023' version: '>= 1.0.6' +- type: software + title: withr + abstract: 'withr: Run Code ''With'' Temporarily Modified Global State' + notes: Suggests + url: https://withr.r-lib.org + repository: https://CRAN.R-project.org/package=withr + authors: + - family-names: Hester + given-names: Jim + - family-names: Henry + given-names: Lionel + email: lionel@rstudio.com + - family-names: Müller + given-names: Kirill + email: krlmlr+r@mailbox.org + - family-names: Ushey + given-names: Kevin + email: kevinushey@gmail.com + - family-names: Wickham + given-names: Hadley + email: hadley@rstudio.com + - family-names: Chang + given-names: Winston + year: '2023' - type: software title: WRS2 abstract: 'WRS2: A Collection of Robust Statistical Methods' diff --git a/DESCRIPTION b/DESCRIPTION index 9072b8dce..88d4fb97a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ggstatsplot Title: 'ggplot2' Based Plots with Statistical Details -Version: 0.12.0.9000 +Version: 0.12.1 Authors@R: c(person(given = "Indrajeet", family = "Patil", @@ -31,18 +31,18 @@ BugReports: https://github.com/IndrajeetPatil/ggstatsplot/issues Depends: R (>= 4.1.0) Imports: - correlation (>= 0.8.4), - datawizard (>= 0.8.0), + correlation, + datawizard (>= 0.9.0), dplyr (>= 1.1.3), - ggcorrplot (>= 0.1.4.1), + ggcorrplot, ggplot2 (>= 3.4.3), ggrepel (>= 0.9.3), ggside (>= 0.2.2), ggsignif (>= 0.6.4), glue, - insight (>= 0.19.4), + insight (>= 0.19.5), paletteer, - parameters (>= 0.21.1), + parameters (>= 0.21.2), patchwork, performance (>= 0.10.5), purrr (>= 1.0.2), @@ -51,8 +51,6 @@ Imports: statsExpressions (>= 1.5.2), tidyr, utils -Remotes: - r-lib/vdiffr Suggests: afex, BayesFactor (>= 0.9.12-4.4), @@ -70,6 +68,7 @@ Suggests: testthat (>= 3.1.10), tibble, vdiffr (>= 1.0.6), + withr, WRS2 VignetteBuilder: knitr @@ -83,4 +82,6 @@ Roxygen: list( RoxygenNote: 7.2.3.9000 Config/testthat/edition: 3 Config/testthat/parallel: true -Config/Needs/check: anthonynorth/roxyglobals +Config/Needs/check: + anthonynorth/roxyglobals, + r-lib/vdiffr diff --git a/NEWS.md b/NEWS.md index f7f5985ed..792589284 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,17 @@ -# ggstatsplot 0.12.0.9000 +# ggstatsplot 0.12.1 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: +## MINOR CHANGES + +- Maintenance updates for changes in upstream dependencies. + +- `ggbarstats()` gains `sample.size.label.args` parameter to pass additional + arguments to `ggplot2::geom_text()`. + # ggstatsplot 0.12.0 ## BREAKING CHANGES diff --git a/R/ggbarstats.R b/R/ggbarstats.R index dc38f65c4..69ff28e1b 100644 --- a/R/ggbarstats.R +++ b/R/ggbarstats.R @@ -13,6 +13,8 @@ #' #' @inheritParams ggpiestats #' @inheritParams ggbetweenstats +#' @param sample.size.label.args Additional aesthetic arguments that will be passed to +#' `ggplot2::geom_text()`. #' #' @inheritSection statsExpressions::contingency_table Contingency table analyses #' @@ -44,7 +46,8 @@ ggbarstats <- function(data, paired = FALSE, results.subtitle = TRUE, label = "percentage", - label.args = list(alpha = 1, fill = "white"), + label.args = list(alpha = 1.0, fill = "white"), + sample.size.label.args = list(size = 4.0), k = 2L, proportion.test = results.subtitle, perc.k = 0L, @@ -53,7 +56,7 @@ ggbarstats <- function(data, conf.level = 0.95, sampling.plan = "indepMulti", fixed.margin = "rows", - prior.concentration = 1, + prior.concentration = 1.0, title = NULL, subtitle = NULL, caption = NULL, @@ -127,8 +130,8 @@ ggbarstats <- function(data, plotBar <- ggplot(descriptive_df, aes({{ y }}, perc, fill = {{ x }})) + geom_bar(stat = "identity", position = "fill", color = "black") + scale_y_continuous( - labels = function(x) paste0(x * 100, "%"), - breaks = seq(from = 0, to = 1, by = 0.10), + labels = function(x) paste0(x * 100L, "%"), + breaks = seq(from = 0.0, to = 1.0, by = 0.10), minor_breaks = seq(from = 0.05, to = 0.95, by = 0.10) ) + exec( @@ -157,10 +160,11 @@ ggbarstats <- function(data, # adding sample size info plotBar <- plotBar + - geom_text( + exec( + geom_text, data = onesample_df, mapping = aes(x = {{ y }}, y = -0.05, label = N, fill = NULL), - size = 4 + !!!sample.size.label.args ) # annotations ------------------------------------------ diff --git a/R/ggbetweenstats.R b/R/ggbetweenstats.R index 8fbf6b37d..735b264e7 100644 --- a/R/ggbetweenstats.R +++ b/R/ggbetweenstats.R @@ -280,10 +280,7 @@ ggbetweenstats <- function(data, ) # secondary label axis to give pairwise comparisons test details - seclabel <- .pairwise_seclabel( - unique(mpc_df$test), - ifelse(type == "bayes", "all", pairwise.display) - ) + seclabel <- .pairwise_seclabel(unique(mpc_df$test), ifelse(type == "bayes", "all", pairwise.display)) } # annotations ------------------------ diff --git a/R/ggbetweenstats_helpers.R b/R/ggbetweenstats_helpers.R index ead8406a1..5c4b255b6 100644 --- a/R/ggbetweenstats_helpers.R +++ b/R/ggbetweenstats_helpers.R @@ -32,15 +32,15 @@ y, centrality.path = FALSE, centrality.path.args = list( - linewidth = 1, + linewidth = 1.0, color = "red", alpha = 0.5 ), - centrality.point.args = list(size = 5, color = "darkred"), + centrality.point.args = list(size = 5.0, color = "darkred"), centrality.label.args = list( - size = 3, + size = 3.0, nudge_x = 0.4, - segment.linetype = 4 + segment.linetype = 4.0 ), ...) { centrality_df <- suppressWarnings(centrality_description(data, {{ x }}, {{ y }}, ...)) @@ -201,9 +201,9 @@ # which comparisons were displayed? display <- case_when( - substr(pairwise.display, 1L, 1L) == "s" ~ "significant", - substr(pairwise.display, 1L, 1L) == "n" ~ "non-significant", - TRUE ~ "all" + startsWith(pairwise.display, "s") ~ "significant", + startsWith(pairwise.display, "n") ~ "non-significant", + .default = "all" ) parse(text = glue("list('Pairwise test:'~bold('{test}'), 'Bars shown:'~bold('{display}'))")) diff --git a/R/ggcoefstats.R b/R/ggcoefstats.R index fffb86b6b..e4d7ee2b1 100644 --- a/R/ggcoefstats.R +++ b/R/ggcoefstats.R @@ -133,13 +133,13 @@ ggcoefstats <- function(x, subtitle = NULL, caption = NULL, only.significant = FALSE, - point.args = list(size = 3, color = "blue", na.rm = TRUE), + point.args = list(size = 3.0, color = "blue", na.rm = TRUE), errorbar.args = list(height = 0, na.rm = TRUE), vline = TRUE, - vline.args = list(linewidth = 1, linetype = "dashed"), + vline.args = list(linewidth = 1.0, 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.0, direction = "y", min.segment.length = 0), package = "RColorBrewer", palette = "Dark2", ggtheme = ggstatsplot::theme_ggstatsplot(), diff --git a/R/gghistostats_helpers.R b/R/gghistostats_helpers.R index 4f9216ea2..ef05ef35b 100644 --- a/R/gghistostats_helpers.R +++ b/R/gghistostats_helpers.R @@ -29,7 +29,7 @@ #' @noRd .histo_labeller <- function(plot, x, centrality.line.args, ...) { # compute centrality measure (with a temporary data frame) - df_central <- suppressWarnings(centrality_description(tibble(.x = ".x", "var" = x), .x, var, ...)) + df_central <- suppressWarnings(centrality_description(tibble(.x = ".x", var = x), .x, var, ...)) # adding a vertical line corresponding to centrality parameter plot + diff --git a/R/ggpiestats.R b/R/ggpiestats.R index 77edb228e..eac23a1ac 100644 --- a/R/ggpiestats.R +++ b/R/ggpiestats.R @@ -28,8 +28,8 @@ #' on the label in each pie slice. Possible options are `"percentage"` #' (default), `"counts"`, `"both"`. #' @param label.args Additional aesthetic arguments that will be passed to -#' `geom_label`. -#' @param label.repel Whether labels should be repelled using `ggrepel` package. +#' `ggplot2::geom_label()`. +#' @param label.repel Whether labels should be repelled using `{ggrepel}` package. #' This can be helpful in case the labels are overlapping. #' @param legend.title Title text for the legend. #' @inheritParams ggbetweenstats @@ -100,7 +100,7 @@ ggpiestats <- function(data, y <- if (!quo_is_null(enquo(y))) ensym(y) # one-way or two-way table? - test <- ifelse(!quo_is_null(enquo(y)), "two.way", "one.way") + test <- ifelse(quo_is_null(enquo(y)), "one.way", "two.way") data %<>% select({{ x }}, {{ y }}, .counts = {{ counts }}) %>% @@ -164,7 +164,7 @@ ggpiestats <- function(data, mapping = aes(fill = {{ x }}), position = "fill", color = "black", - width = 1 + width = 1.0 ) # whether labels need to be repelled @@ -179,7 +179,7 @@ ggpiestats <- function(data, position = position_fill(vjust = 0.5), min.segment.length = 0, fill = "white", - alpha = 1, + alpha = 1.0, !!!label.args ) })) @@ -204,7 +204,7 @@ ggpiestats <- function(data, geom_text, data = onesample_df, mapping = aes(label = .label, x = 1.65, y = 0.5), - position = position_fill(vjust = 1), + position = position_fill(vjust = 1.0), size = 2.8, parse = TRUE ) diff --git a/R/ggpiestats_ggbarstats_helpers.R b/R/ggpiestats_ggbarstats_helpers.R index c9b62b4a3..ce52ce6ac 100644 --- a/R/ggpiestats_ggbarstats_helpers.R +++ b/R/ggpiestats_ggbarstats_helpers.R @@ -12,7 +12,7 @@ descriptive_data <- function(data, .label = case_when( grepl("perc|prop", label.content) ~ paste0(round(perc, perc.k), "%"), grepl("count|n|N", label.content) ~ .prettyNum(counts), - TRUE ~ paste0(.prettyNum(counts), "\n", "(", round(perc, perc.k), "%)") + .default = paste0(.prettyNum(counts), "\n", "(", round(perc, perc.k), "%)") ) ) %>% # reorder the category factor levels to order the legend mutate({{ x }} := factor({{ x }}, unique({{ x }}))) diff --git a/R/ggwithinstats.R b/R/ggwithinstats.R index dbbfbc91e..5bb130447 100644 --- a/R/ggwithinstats.R +++ b/R/ggwithinstats.R @@ -219,10 +219,7 @@ ggwithinstats <- function(data, ) # secondary label axis to give pairwise comparisons test details - seclabel <- .pairwise_seclabel( - unique(mpc_df$test), - ifelse(type == "bayes", "all", pairwise.display) - ) + seclabel <- .pairwise_seclabel(unique(mpc_df$test), ifelse(type == "bayes", "all", pairwise.display)) } # annotations ------------------------- diff --git a/R/globals.R b/R/globals.R index bc07fee41..5617b1ce7 100644 --- a/R/globals.R +++ b/R/globals.R @@ -19,6 +19,8 @@ utils::globalVariables(c( ".counts", # "perc", # ".label", # + "counts", # + "perc", # "counts", # <.cat_counter> "counts", # ".", # diff --git a/codemeta.json b/codemeta.json index 65497725f..d681f0d34 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/IndrajeetPatil/ggstatsplot", "issueTracker": "https://github.com/IndrajeetPatil/ggstatsplot/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.12.0.9000", + "version": "0.12.1", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -252,7 +252,19 @@ "name": "Comprehensive R Archive Network (CRAN)", "url": "https://cran.r-project.org" }, - "sameAs": "https://github.com/r-lib/vdiffr" + "sameAs": "https://CRAN.R-project.org/package=vdiffr" + }, + { + "@type": "SoftwareApplication", + "identifier": "withr", + "name": "withr", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=withr" }, { "@type": "SoftwareApplication", @@ -278,7 +290,6 @@ "@type": "SoftwareApplication", "identifier": "correlation", "name": "correlation", - "version": ">= 0.8.4", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -291,7 +302,7 @@ "@type": "SoftwareApplication", "identifier": "datawizard", "name": "datawizard", - "version": ">= 0.8.0", + "version": ">= 0.9.0", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -317,7 +328,6 @@ "@type": "SoftwareApplication", "identifier": "ggcorrplot", "name": "ggcorrplot", - "version": ">= 0.1.4.1", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -394,7 +404,7 @@ "@type": "SoftwareApplication", "identifier": "insight", "name": "insight", - "version": ">= 0.19.4", + "version": ">= 0.19.5", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -419,7 +429,7 @@ "@type": "SoftwareApplication", "identifier": "parameters", "name": "parameters", - "version": ">= 0.21.1", + "version": ">= 0.21.2", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -515,7 +525,7 @@ }, "SystemRequirements": null }, - "fileSize": "9407.077KB", + "fileSize": "9389.207KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/cran-comments.md b/cran-comments.md index 5f724bbe4..782355f2b 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,11 +2,11 @@ 0 errors | 0 warnings | 0 note -- Maintenance release. +- No user-visible changes. Maintenance-only release. ## revdepcheck results -We checked 3 reverse dependencies, comparing R CMD check results across CRAN and +We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. * We saw 0 new problems diff --git a/data-raw/bugs_long.R b/data-raw/bugs_long.R index 4f8b6c191..ec1786b86 100644 --- a/data-raw/bugs_long.R +++ b/data-raw/bugs_long.R @@ -8,4 +8,4 @@ bugs_long <- bugs |> names(bugs_long) <- tolower(names(bugs_long)) # saving the data -save(bugs_long, file = "data/bugs_long.rdata") +save(bugs_long, file = file.path("data", "bugs_long.rdata")) diff --git a/data-raw/bugs_wide.R b/data-raw/bugs_wide.R index 03187c18c..e22aed167 100644 --- a/data-raw/bugs_wide.R +++ b/data-raw/bugs_wide.R @@ -4,4 +4,4 @@ bugs_wide <- tibble::as_tibble(bugs) names(bugs_wide) <- tolower(names(bugs_wide)) -save(bugs_wide, file = "data/bugs_wide.rdata") +save(bugs_wide, file = file.path("data", "bugs_wide.rdata")) diff --git a/data-raw/iris_long.R b/data-raw/iris_long.R index 851150bde..fcb10e8aa 100644 --- a/data-raw/iris_long.R +++ b/data-raw/iris_long.R @@ -21,5 +21,5 @@ iris_long <- datasets::iris |> dplyr::glimpse(iris_long) -readr::write_csv(iris_long, file = "data-raw/iris_long.csv") -save(iris_long, file = "data/iris_long.rdata") +readr::write_csv(iris_long, file = file.path("data-raw", "iris_long.csv")) +save(iris_long, file = file.path("data-raw", "iris_long.rdata")) diff --git a/data-raw/movies_wide_long.R b/data-raw/movies_wide_long.R index b1b51e972..4ffd40f7f 100644 --- a/data-raw/movies_wide_long.R +++ b/data-raw/movies_wide_long.R @@ -4,13 +4,13 @@ library(magrittr) movies_wide <- ggplot2movies::movies %>% dplyr::select(c(title:votes, mpaa:Short)) %>% dplyr::filter(mpaa != "", mpaa != "NC-17") %>% - dplyr::filter(Short != 1, Documentary != 1) %>% + dplyr::filter(Short != 1L, Documentary != 1L) %>% dplyr::select(-c(Short, Documentary)) %>% tidyr::drop_na() %>% dplyr::mutate(budget = budget / 1000000) %>% dplyr::mutate(mpaa = factor(mpaa)) %>% dplyr::mutate(NumGenre = as.integer(rowSums(dplyr::select(., Action:Romance)))) %>% - dplyr::filter(NumGenre > 0) + dplyr::filter(NumGenre > 0L) # see the selected data (we have data from 1,579 movies) dplyr::glimpse(movies_wide) diff --git a/man/ggbarstats.Rd b/man/ggbarstats.Rd index 7797f3f2c..41e0a20bc 100644 --- a/man/ggbarstats.Rd +++ b/man/ggbarstats.Rd @@ -14,6 +14,7 @@ ggbarstats( results.subtitle = TRUE, label = "percentage", label.args = list(alpha = 1, fill = "white"), + sample.size.label.args = list(size = 4), k = 2L, proportion.test = results.subtitle, perc.k = 0L, @@ -80,7 +81,10 @@ on the label in each pie slice. Possible options are \code{"percentage"} (default), \code{"counts"}, \code{"both"}.} \item{label.args}{Additional aesthetic arguments that will be passed to -\code{geom_label}.} +\code{ggplot2::geom_label()}.} + +\item{sample.size.label.args}{Additional aesthetic arguments that will be passed to +\code{ggplot2::geom_text()}.} \item{k}{Number of digits after decimal point (should be an integer) (Default: \code{k = 2L}).} @@ -170,6 +174,7 @@ For details, see: graphical element \tab \code{geom} used \tab argument for further modification \cr bars \tab \code{ggplot2::geom_bar()} \tab \code{NA} \cr descriptive labels \tab \code{ggplot2::geom_label()} \tab \code{label.args} \cr + sample size labels \tab \code{ggplot2::geom_text()} \tab \code{sample.size.label.args} \cr } } diff --git a/man/ggpiestats.Rd b/man/ggpiestats.Rd index dd11e9370..497b178cf 100644 --- a/man/ggpiestats.Rd +++ b/man/ggpiestats.Rd @@ -79,9 +79,9 @@ on the label in each pie slice. Possible options are \code{"percentage"} (default), \code{"counts"}, \code{"both"}.} \item{label.args}{Additional aesthetic arguments that will be passed to -\code{geom_label}.} +\code{ggplot2::geom_label()}.} -\item{label.repel}{Whether labels should be repelled using \code{ggrepel} package. +\item{label.repel}{Whether labels should be repelled using \code{{ggrepel}} package. This can be helpful in case the labels are overlapping.} \item{k}{Number of digits after decimal point (should be an integer) diff --git a/man/grouped_ggbarstats.Rd b/man/grouped_ggbarstats.Rd index a4589f04d..e8ecebfb2 100644 --- a/man/grouped_ggbarstats.Rd +++ b/man/grouped_ggbarstats.Rd @@ -21,6 +21,8 @@ ungrouped before they are entered as \code{data}.} \item{...}{ Arguments passed on to \code{\link[=ggbarstats]{ggbarstats}} \describe{ + \item{\code{sample.size.label.args}}{Additional aesthetic arguments that will be passed to +\code{ggplot2::geom_text()}.} \item{\code{x}}{The variable to use as the \strong{rows} in the contingency table. Please note that if there are empty factor levels in your variable, they will be dropped.} @@ -39,7 +41,7 @@ labels (Default: \code{0L}).} on the label in each pie slice. Possible options are \code{"percentage"} (default), \code{"counts"}, \code{"both"}.} \item{\code{label.args}}{Additional aesthetic arguments that will be passed to -\code{geom_label}.} +\code{ggplot2::geom_label()}.} \item{\code{legend.title}}{Title text for the legend.} \item{\code{bf.message}}{Logical that decides whether to display Bayes Factor in favor of the \emph{null} hypothesis. This argument is relevant only \strong{for diff --git a/man/grouped_ggpiestats.Rd b/man/grouped_ggpiestats.Rd index 813f03747..b43faceb7 100644 --- a/man/grouped_ggpiestats.Rd +++ b/man/grouped_ggpiestats.Rd @@ -39,8 +39,8 @@ labels (Default: \code{0L}).} on the label in each pie slice. Possible options are \code{"percentage"} (default), \code{"counts"}, \code{"both"}.} \item{\code{label.args}}{Additional aesthetic arguments that will be passed to -\code{geom_label}.} - \item{\code{label.repel}}{Whether labels should be repelled using \code{ggrepel} package. +\code{ggplot2::geom_label()}.} + \item{\code{label.repel}}{Whether labels should be repelled using \code{{ggrepel}} package. This can be helpful in case the labels are overlapping.} \item{\code{legend.title}}{Title text for the legend.} \item{\code{bf.message}}{Logical that decides whether to display Bayes Factor in diff --git a/man/rmd-fragments/ggbarstats_graphics.Rmd b/man/rmd-fragments/ggbarstats_graphics.Rmd index 5ec85a7c7..2b1b62fb8 100644 --- a/man/rmd-fragments/ggbarstats_graphics.Rmd +++ b/man/rmd-fragments/ggbarstats_graphics.Rmd @@ -2,3 +2,4 @@ | :----------------- | :---------------------- | :-------------------------------- | | bars | `ggplot2::geom_bar()` | `NA` | | descriptive labels | `ggplot2::geom_label()` | `label.args` | +| sample size labels | `ggplot2::geom_text()` | `sample.size.label.args` | diff --git a/old/benchmarking.Rmd b/old/benchmarking.Rmd index b92f8d01e..174626ce1 100644 --- a/old/benchmarking.Rmd +++ b/old/benchmarking.Rmd @@ -1,38 +1,14 @@ --- title: "Benchmarking" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_document: - fig_width: 6 - fig.align: 'center' - fig.asp: 0.618 - dpi: 300 toc: true - toc_depth: 3 - warning: FALSE - message: FALSE --- ```{r} #| label = "setup", #| include = FALSE -options( - tibble.width = Inf, - pillar.bold = TRUE, - pillar.neg = TRUE, - pillar.subtle_num = TRUE, - pillar.min_chars = Inf -) - -knitr::opts_chunk$set( - collapse = TRUE, - dpi = 300, - out.width = "100%", - comment = "#>", - warning = FALSE, - message = FALSE -) +source("../setup.R") ``` # Introduction diff --git a/old/combine_plots.Rmd b/old/combine_plots.Rmd index f6b4d2ca8..23d6f15db 100644 --- a/old/combine_plots.Rmd +++ b/old/combine_plots.Rmd @@ -1,16 +1,8 @@ --- title: "combine_plots" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: - fig_width: 6 - fig.align: 'center' - fig.asp: 0.618 - dpi: 300 toc: true - warning: FALSE - message: FALSE vignette: > %\VignetteIndexEntry{combine_plots} %\VignetteEngine{knitr::rmarkdown} diff --git a/old/dependencies.Rmd b/old/dependencies.Rmd index 33b2a4468..96c0e010d 100644 --- a/old/dependencies.Rmd +++ b/old/dependencies.Rmd @@ -4,14 +4,7 @@ author: "Indrajeet Patil" date: "`r Sys.Date()`" output: rmarkdown::html_document: - fig_width: 6 - fig.align: 'center' - fig.asp: 0.618 - dpi: 300 toc: true - toc_depth: 3 - warning: FALSE - message: FALSE --- ```{r} diff --git a/old/ggcoefstats_old.Rmd b/old/ggcoefstats_old.Rmd index 27203bfe6..b91e218f3 100644 --- a/old/ggcoefstats_old.Rmd +++ b/old/ggcoefstats_old.Rmd @@ -1,17 +1,8 @@ --- title: "ggcoefstats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: - fig_width: 6 - fig.align: 'center' - fig.asp: 0.618 - dpi: 300 toc: true - warning: FALSE - message: FALSE - error: TRUE vignette: > %\VignetteIndexEntry{ggcoefstats} %\VignetteEngine{knitr::rmarkdown} diff --git a/old/purrr_examples.Rmd b/old/purrr_examples.Rmd index bb57ce870..695136e53 100644 --- a/old/purrr_examples.Rmd +++ b/old/purrr_examples.Rmd @@ -1,16 +1,8 @@ --- title: "using `{ggstatsplot}` with the `{purrr}` package" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_document: - fig_width: 6 - fig.align: 'center' - fig.asp: 0.618 - dpi: 300 toc: true - warning: FALSE - message: FALSE --- ```{r} diff --git a/tests/testthat.R b/tests/testthat.R index 019ff18ff..408de2884 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,6 +1,6 @@ # graphics engine changed in this version, and so snapshots generated on # previous R version won't work -if (getRversion() > "4.1.0" && getRversion() < "4.4.0") { +if (getRversion() < "4.4.0") { library(testthat) suppressPackageStartupMessages(library(ggstatsplot)) diff --git a/tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg b/tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg index 7932e75df..66b5b55a2 100644 --- a/tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg +++ b/tests/testthat/_snaps/ggcoefstats/meta-analysis-works.svg @@ -120,7 +120,7 @@ difference posterior = -0.39 +0.38 , C @@ -131,10 +131,10 @@ I [ --0.02 +-0.05 , -0.81 +0.79 ] , diff --git a/tests/testthat/_snaps/pairwise_ggsignif/between-bayes.svg b/tests/testthat/_snaps/pairwise_ggsignif/between-bayes.svg index 589e8c68e..15e000e69 100644 --- a/tests/testthat/_snaps/pairwise_ggsignif/between-bayes.svg +++ b/tests/testthat/_snaps/pairwise_ggsignif/between-bayes.svg @@ -21,285 +21,162 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -μ - -M -A -P -= -5.021 - -μ - -M -A -P -= -5.748 - -μ - -M -A -P -= -6.399 -l -o -g -e -( -B -F -01 -) -= --33.669 - - - -l -o -g -e -( -B -F -01 -) -= --56.343 - - - -l -o -g -e -( -B -F -01 -) -= --11.162 - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +μ + +M +A +P += +23.135 + +μ + +M +A +P += +20.890 + +μ + +M +A +P += +15.191 +l +o +g +e +( +B +F +01 +) += +-3.179 + + + +l +o +g +e +( +B +F +01 +) += +-12.383 + + + +l +o +g +e +( +B +F +01 +) += +-4.358 + + + -5 -6 -7 -8 -9 - - - - - - - - -setosa -(n = 50) -versicolor -(n = 50) -virginica -(n = 50) -Species -Sepal.Length +10 +20 +30 +40 + + + + + + + +4 +(n = 11) +6 +(n = 7) +8 +(n = 14) +cyl +mpg Pairwise test: Student's t diff --git a/tests/testthat/test-ggbarstats.R b/tests/testthat/test-ggbarstats.R index 9f1491926..22f6c1344 100644 --- a/tests/testthat/test-ggbarstats.R +++ b/tests/testthat/test-ggbarstats.R @@ -3,13 +3,13 @@ set.seed(123) survey_data <- dplyr::tibble( `1st survey` = c("Approve", "Approve", "Disapprove", "Disapprove"), `2nd survey` = c("Approve", "Disapprove", "Approve", "Disapprove"), - `Counts` = c(794L, 150L, 86L, 570L) + Counts = c(794L, 150L, 86L, 570L) ) survey_data_NA <- dplyr::tibble( `1st survey` = c("Approve", "Approve", "Disapprove", "Disapprove"), `2nd survey` = c("Approve", "Disapprove", "Approve", "Disapprove"), - `Counts` = c(794L, 150L, NA_integer_, 570L) + Counts = c(794L, 150L, NA_integer_, 570L) ) diff --git a/tests/testthat/test-ggcoefstats.R b/tests/testthat/test-ggcoefstats.R index 47483806d..1ec7d8c84 100644 --- a/tests/testthat/test-ggcoefstats.R +++ b/tests/testthat/test-ggcoefstats.R @@ -7,9 +7,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("survival") - - library(survival) + skip_if_not_installed("withr") set.seed(123) expect_doppelganger( @@ -29,14 +27,6 @@ test_that("default plots are rendered correctly for each type of statistic", { fig = ggcoefstats(stats::aov(wt ~ mpg * am, mtcars), effectsize.type = "omega") ) - set.seed(123) - expect_doppelganger( - title = "chi2-statistic", - fig = suppressWarnings(ggcoefstats( - survival::coxph(Surv(time, status) ~ age + sex + frailty(inst), lung) - )) - ) - df <- as.data.frame(Titanic) mod_glm <- stats::glm( @@ -51,6 +41,17 @@ test_that("default plots are rendered correctly for each type of statistic", { title = "z-statistic", fig = ggcoefstats(mod_glm, conf.level = 0.90) ) + + skip_if_not_installed("survival") + withr::local_package("survival") + + set.seed(123) + expect_doppelganger( + title = "chi2-statistic", + fig = suppressWarnings(ggcoefstats( + survival::coxph(Surv(time, status) ~ age + sex + frailty(inst), lung) + )) + ) }) df_meta <- tibble( @@ -135,8 +136,12 @@ test_that( 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)) + withr::local_package("lme4") + m_lmer <- ggcoefstats( + lme4::lmer(Reaction ~ Days + (Days | Subject), + data = lme4::sleepstudy + ) + ) expect_s3_class(m_lmer, "ggplot") diff --git a/tests/testthat/test-ggpiestats.R b/tests/testthat/test-ggpiestats.R index e12aa04c8..7dbf44f12 100644 --- a/tests/testthat/test-ggpiestats.R +++ b/tests/testthat/test-ggpiestats.R @@ -3,13 +3,13 @@ set.seed(123) survey_data <- dplyr::tibble( `1st survey` = c("Approve", "Approve", "Disapprove", "Disapprove"), `2nd survey` = c("Approve", "Disapprove", "Approve", "Disapprove"), - `Counts` = c(794L, 150L, 86L, 570L) + Counts = c(794L, 150L, 86L, 570L) ) survey_data_NA <- dplyr::tibble( `1st survey` = c("Approve", "Approve", "Disapprove", "Disapprove"), `2nd survey` = c("Approve", "Disapprove", "Approve", "Disapprove"), - `Counts` = c(794L, 150L, NA_integer_, 570L) + Counts = c(794L, 150L, NA_integer_, 570L) ) # checking default outputs ----------------------------------------- diff --git a/tests/testthat/test-pairwise_ggsignif.R b/tests/testthat/test-pairwise_ggsignif.R index 2d1a92333..07db227a1 100644 --- a/tests/testthat/test-pairwise_ggsignif.R +++ b/tests/testthat/test-pairwise_ggsignif.R @@ -116,7 +116,7 @@ test_that( set.seed(123) expect_doppelganger( title = "between - bayes", - fig = ggbetweenstats(iris, Species, Sepal.Length, + fig = ggbetweenstats(mtcars, cyl, mpg, type = "bayes", results.subtitle = FALSE, k = 3L diff --git a/vignettes/additional.Rmd b/vignettes/additional.Rmd index b52adeb70..9ac12cdba 100644 --- a/vignettes/additional.Rmd +++ b/vignettes/additional.Rmd @@ -1,7 +1,5 @@ --- title: "Additional vignettes" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/ggstatsplot.Rmd b/vignettes/ggstatsplot.Rmd index c23415cca..729115105 100644 --- a/vignettes/ggstatsplot.Rmd +++ b/vignettes/ggstatsplot.Rmd @@ -1,7 +1,5 @@ --- title: "Visualizations with statistical details: The 'ggstatsplot' approach" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/faq.Rmd b/vignettes/web_only/faq.Rmd index 3bbf20a38..6918a5a8d 100644 --- a/vignettes/web_only/faq.Rmd +++ b/vignettes/web_only/faq.Rmd @@ -1,7 +1,5 @@ --- title: "Frequently Asked Questions (FAQ)" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/ggbarstats.Rmd b/vignettes/web_only/ggbarstats.Rmd index ef966c11f..9352173c7 100644 --- a/vignettes/web_only/ggbarstats.Rmd +++ b/vignettes/web_only/ggbarstats.Rmd @@ -1,7 +1,5 @@ --- title: "ggbarstats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true @@ -196,31 +194,32 @@ unique combination of `Boat` and `Month`. # (this is completely fictional; I don't know first thing about fishing!) -( - fishing <- tibble::as_tibble(data.frame( - Boat = c(rep("B", 4), rep("A", 4), rep("A", 4), rep("B", 4)), - Month = c(rep("February", 2), rep("March", 2), rep("February", 2), rep("March", 2)), - Fish = c( - "Bass", - "Catfish", - "Cod", - "Haddock", - "Cod", - "Haddock", - "Bass", - "Catfish", - "Bass", - "Catfish", - "Cod", - "Haddock", - "Cod", - "Haddock", - "Bass", - "Catfish" - ), - SumOfCaught = c(25, 20, 35, 40, 40, 25, 30, 42, 40, 30, 33, 26, 100, 30, 20, 20) - )) -) + +fishing <- tibble::as_tibble(data.frame( + Boat = c(rep("B", 4), rep("A", 4), rep("A", 4), rep("B", 4)), + Month = c(rep("February", 2), rep("March", 2), rep("February", 2), rep("March", 2)), + Fish = c( + "Bass", + "Catfish", + "Cod", + "Haddock", + "Cod", + "Haddock", + "Bass", + "Catfish", + "Bass", + "Catfish", + "Cod", + "Haddock", + "Cod", + "Haddock", + "Bass", + "Catfish" + ), + SumOfCaught = c(25, 20, 35, 40, 40, 25, 30, 42, 40, 30, 33, 26, 100, 30, 20, 20) +)) + +fishing ``` When the data is organized this way, we make a slightly different call to the diff --git a/vignettes/web_only/ggbetweenstats.Rmd b/vignettes/web_only/ggbetweenstats.Rmd index 028123748..663b6871d 100644 --- a/vignettes/web_only/ggbetweenstats.Rmd +++ b/vignettes/web_only/ggbetweenstats.Rmd @@ -1,7 +1,5 @@ --- title: "ggbetweenstats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/ggcoefstats.Rmd b/vignettes/web_only/ggcoefstats.Rmd index c271d032b..ed4851efb 100644 --- a/vignettes/web_only/ggcoefstats.Rmd +++ b/vignettes/web_only/ggcoefstats.Rmd @@ -1,7 +1,5 @@ --- title: "ggcoefstats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/ggcorrmat.Rmd b/vignettes/web_only/ggcorrmat.Rmd index 87971d0d0..4f36cb15e 100644 --- a/vignettes/web_only/ggcorrmat.Rmd +++ b/vignettes/web_only/ggcorrmat.Rmd @@ -1,7 +1,5 @@ --- title: "ggcorrmat" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/ggdotplotstats.Rmd b/vignettes/web_only/ggdotplotstats.Rmd index 1201e1da3..4ffe882e9 100644 --- a/vignettes/web_only/ggdotplotstats.Rmd +++ b/vignettes/web_only/ggdotplotstats.Rmd @@ -1,7 +1,5 @@ --- title: "ggdotplotstats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/gghistostats.Rmd b/vignettes/web_only/gghistostats.Rmd index 5b31984f5..235f543fa 100644 --- a/vignettes/web_only/gghistostats.Rmd +++ b/vignettes/web_only/gghistostats.Rmd @@ -1,16 +1,8 @@ --- title: "gghistostats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: - fig_width: 6 - fig.align: 'center' - fig.asp: 0.618 - dpi: 300 toc: true - warning: FALSE - message: FALSE vignette: > %\VignetteIndexEntry{gghistostats} %\VignetteEngine{knitr::rmarkdown} diff --git a/vignettes/web_only/ggpiestats.Rmd b/vignettes/web_only/ggpiestats.Rmd index 98dc0ce25..3c81b0995 100644 --- a/vignettes/web_only/ggpiestats.Rmd +++ b/vignettes/web_only/ggpiestats.Rmd @@ -1,7 +1,5 @@ --- title: "ggpiestats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true @@ -121,9 +119,6 @@ survived was different between the sexes using `ggpiestats`. #| fig.height = 5, #| fig.width = 8 - - - ggpiestats( data = Titanic_full, x = Survived, @@ -207,33 +202,33 @@ unique combination of `Boat` and `Month`. #| fig.height = 8, #| fig.width = 9 - # (this is completely fictional; I don't know first thing about fishing!) -( - fishing <- tibble::as_tibble(data.frame( - Boat = c(rep("B", 4), rep("A", 4), rep("A", 4), rep("B", 4)), - Month = c(rep("February", 2), rep("March", 2), rep("February", 2), rep("March", 2)), - Fish = c( - "Bass", - "Catfish", - "Cod", - "Haddock", - "Cod", - "Haddock", - "Bass", - "Catfish", - "Bass", - "Catfish", - "Cod", - "Haddock", - "Cod", - "Haddock", - "Bass", - "Catfish" - ), - SumOfCaught = c(25, 20, 35, 40, 40, 25, 30, 42, 40, 30, 33, 26, 100, 30, 20, 20) - )) -) + +fishing <- tibble::as_tibble(data.frame( + Boat = c(rep("B", 4), rep("A", 4), rep("A", 4), rep("B", 4)), + Month = c(rep("February", 2), rep("March", 2), rep("February", 2), rep("March", 2)), + Fish = c( + "Bass", + "Catfish", + "Cod", + "Haddock", + "Cod", + "Haddock", + "Bass", + "Catfish", + "Bass", + "Catfish", + "Cod", + "Haddock", + "Cod", + "Haddock", + "Bass", + "Catfish" + ), + SumOfCaught = c(25, 20, 35, 40, 40, 25, 30, 42, 40, 30, 33, 26, 100, 30, 20, 20) +)) + +fishing ``` When the data is organized this way, we make a slightly different call to the diff --git a/vignettes/web_only/ggscatterstats.Rmd b/vignettes/web_only/ggscatterstats.Rmd index c77f85691..765c5c50e 100644 --- a/vignettes/web_only/ggscatterstats.Rmd +++ b/vignettes/web_only/ggscatterstats.Rmd @@ -1,7 +1,5 @@ --- title: "ggscatterstats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/ggwithinstats.Rmd b/vignettes/web_only/ggwithinstats.Rmd index a06a1823f..6c77ac608 100644 --- a/vignettes/web_only/ggwithinstats.Rmd +++ b/vignettes/web_only/ggwithinstats.Rmd @@ -1,7 +1,5 @@ --- title: "ggwithinstats" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/pairwise.Rmd b/vignettes/web_only/pairwise.Rmd index 0aa6b711a..18793bb36 100644 --- a/vignettes/web_only/pairwise.Rmd +++ b/vignettes/web_only/pairwise.Rmd @@ -1,7 +1,5 @@ --- title: "Pairwise comparisons with `{ggstatsplot}`" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true @@ -88,7 +86,6 @@ See data frame outputs [here](https://indrajeetpatil.github.io/statsExpressions/ #| label = "ggsignif", #| fig.height = 5 - library(ggplot2) library(ggsignif) @@ -133,8 +130,7 @@ p <- ggplot(WRS2::WineTasting, aes(Wine, Taste)) + geom_boxplot() ## using `pairwise_comparisons()` package to create a data frame with results - -(df <- +df <- pairwise_comparisons( WRS2::WineTasting, Wine, @@ -144,7 +140,9 @@ p <- ggplot(WRS2::WineTasting, aes(Wine, Taste)) + paired = TRUE ) %>% dplyr::mutate(groups = purrr::pmap(.l = list(group1, group2), .f = c)) %>% - dplyr::arrange(group1)) + dplyr::arrange(group1) + +df ## using `geom_signif` to display results p + diff --git a/vignettes/web_only/principles.Rmd b/vignettes/web_only/principles.Rmd index 70186d3fb..547c70626 100644 --- a/vignettes/web_only/principles.Rmd +++ b/vignettes/web_only/principles.Rmd @@ -1,7 +1,5 @@ --- title: "Graphic design and statistical reporting principles" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true diff --git a/vignettes/web_only/purrr_examples.Rmd b/vignettes/web_only/purrr_examples.Rmd index 1c21b8668..63925c917 100644 --- a/vignettes/web_only/purrr_examples.Rmd +++ b/vignettes/web_only/purrr_examples.Rmd @@ -1,7 +1,5 @@ --- title: "Using '{ggstatsplot}' with the '{purrr}' package" -author: "Indrajeet Patil" -date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true