diff --git a/DESCRIPTION b/DESCRIPTION index 67124b5e4..8c8add489 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -106,7 +106,7 @@ Suggests: splines, testthat (>= 3.1.7), tidygraph, - vdiffr (>= 1.0.5) + vdiffr (>= 1.0.6) Encoding: UTF-8 Language: en-US Roxygen: list(markdown = TRUE) diff --git a/R/plot.dw_data_tabulate.R b/R/plot.dw_data_tabulate.R index d4be0cf98..725f738f7 100644 --- a/R/plot.dw_data_tabulate.R +++ b/R/plot.dw_data_tabulate.R @@ -11,15 +11,15 @@ #' @param error_bar Logical. Should error bars be displayed? #' If `TRUE`, confidence intervals computed using the Wilson method are shown. #' See Brown et al. (2001) for details. -#' @param ci Confidence Interval (CI) level. Default to `0.95` (⁠95%⁠). -#' @param fill_col Color to use for category columns (default: "#87CEFA"). -#' @param color_error_bar Color to use for error bars (default: "#607B8B"). +#' @param ci Confidence Interval (CI) level. Defaults to `0.95` (`95%`). +#' @param fill_col Color to use for category columns (default: `"#87CEFA"`). +#' @param color_error_bar Color to use for error bars (default: `"#607B8B"`). #' @param ... Unused #' #' @references -#' Brown, L. D., Cai, T. T., & DasGupta, A. (2001). +#' Brown, L. D., Cai, T. T., & Dasgupta, A. (2001). #' Interval estimation for a binomial proportion. -#' _Statistical Science, 16_(2), 101–133. \doi{10.1214/ss/1009213286} +#' _Statistical Science_, _16_(2), 101-133. \doi{10.1214/ss/1009213286} #' #' @rdname plot.dw_data_tabulate #' @export @@ -27,25 +27,34 @@ plot.dw_data_tabulates <- function(x, label_values = TRUE, show_na = c("if_any", "always", "never"), na_label = "(Missing)", - error_bar = TRUE, ci = .95, + error_bar = TRUE, + ci = .95, fill_col = "#87CEFA", color_error_bar = "#607B8B", ...) { show_na <- match.arg(show_na, choices = c("if_any", "always", "never")) - if (length(x) == 1) { + if (length(x) == 1L) { plot.dw_data_tabulate( x[[1]], label_values = label_values, - show_na = show_na, na_label = na_label, - error_bar = error_bar, ci = ci, - fill_col = fill_col, color_error_bar = color_error_bar + show_na = show_na, + na_label = na_label, + error_bar = error_bar, + ci = ci, + fill_col = fill_col, + color_error_bar = color_error_bar ) } else { - lapply(x, plot.dw_data_tabulate, + lapply( + x, + plot.dw_data_tabulate, label_values = label_values, - show_na = show_na, na_label = na_label, - error_bar = error_bar, ci = ci, - fill_col = fill_col, color_error_bar = color_error_bar + show_na = show_na, + na_label = na_label, + error_bar = error_bar, + ci = ci, + fill_col = fill_col, + color_error_bar = color_error_bar ) } } @@ -57,7 +66,8 @@ plot.dw_data_tabulates <- function(x, label_values = TRUE, plot.dw_data_tabulate <- function(x, label_values = TRUE, show_na = c("if_any", "always", "never"), na_label = "(Missing)", - error_bar = TRUE, ci = .95, + error_bar = TRUE, + ci = .95, fill_col = "#87CEFA", color_error_bar = "#607B8B", ...) { diff --git a/R/see-package.R b/R/see-package.R index f94e384d6..303ccae89 100644 --- a/R/see-package.R +++ b/R/see-package.R @@ -9,7 +9,7 @@ #' scales for 'ggplot2'. Color scales are based on #' . #' -#' References: Lüdecke et al. (2021) \doi{10.21105/joss.03393}. +#' References: Luedecke et al. (2021) \doi{10.21105/joss.03393}. #' #' @docType package #' @aliases see see-package diff --git a/inst/WORDLIST b/inst/WORDLIST index cd3c16208..76cfea105 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -4,17 +4,17 @@ Biserial Blomqvist’s Bluebrown BossekJakob -CEFA CMD Cai DOI -DasGupta +Dasgupta Dom GGMs GeomViolinHalf Geoms HDI Hoeffding’s +Luedecke MPE Mattan Modelling diff --git a/man/plot.dw_data_tabulate.Rd b/man/plot.dw_data_tabulate.Rd index 21d22fd2e..0e5d06e1b 100644 --- a/man/plot.dw_data_tabulate.Rd +++ b/man/plot.dw_data_tabulate.Rd @@ -46,11 +46,11 @@ category.} If \code{TRUE}, confidence intervals computed using the Wilson method are shown. See Brown et al. (2001) for details.} -\item{ci}{Confidence Interval (CI) level. Default to \code{0.95} (⁠95\%⁠).} +\item{ci}{Confidence Interval (CI) level. Defaults to \code{0.95} (\verb{95\%}).} -\item{fill_col}{Color to use for category columns (default: "#87CEFA").} +\item{fill_col}{Color to use for category columns (default: \code{"#87CEFA"}).} -\item{color_error_bar}{Color to use for error bars (default: "#607B8B").} +\item{color_error_bar}{Color to use for error bars (default: \code{"#607B8B"}).} \item{...}{Unused} } @@ -58,7 +58,7 @@ See Brown et al. (2001) for details.} Plot tabulated data. } \references{ -Brown, L. D., Cai, T. T., & DasGupta, A. (2001). +Brown, L. D., Cai, T. T., & Dasgupta, A. (2001). Interval estimation for a binomial proportion. -\emph{Statistical Science, 16}(2), 101–133. \doi{10.1214/ss/1009213286} +\emph{Statistical Science}, \emph{16}(2), 101-133. \doi{10.1214/ss/1009213286} } diff --git a/man/see-package.Rd b/man/see-package.Rd index 16d908268..350f054f2 100644 --- a/man/see-package.Rd +++ b/man/see-package.Rd @@ -12,7 +12,7 @@ Provides plotting utilities supporting packages in the 'easystats' ecosystem scales for 'ggplot2'. Color scales are based on \url{https://materialui.co/colors}. -References: Lüdecke et al. (2021) \doi{10.21105/joss.03393}. +References: Luedecke et al. (2021) \doi{10.21105/joss.03393}. } \details{ \code{see} diff --git a/tests/testthat.R b/tests/testthat.R index 3883f51bf..849731173 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,6 +1,6 @@ -# graphics engine changed in R 4.1, and so snapshots generated on -# previous R version won't be compatible -if (require("testthat") && require("vdiffr") && getRversion() > "4.1.0") { +# graphics engine changed in these versions, and so snapshots generated on +# previous R version won't work +if (require("testthat") && require("vdiffr") && getRversion() > "4.1.0" && getRversion() < "4.4.0") { library(testthat) library(see) diff --git a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-density.svg b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-density.svg index ec9f42a8d..7cd00cc0f 100644 --- a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-density.svg +++ b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-density.svg @@ -18,47 +18,86 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - --3 -0 -3 -6 -Residuals -Density -Distribution should be close to the normal curve + +-2 +-1 +0 +1 +2 + +-2 +-1 +0 +1 +2 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line Normality of Residuals diff --git a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-pp.svg b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-pp.svg index 534fa12ce..7721b3c86 100644 --- a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-pp.svg +++ b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-pp.svg @@ -9,7 +9,7 @@ stroke-linejoin: round; stroke-miterlimit: 10.00; } - ]]>qq + ]]> @@ -21,83 +21,85 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.00 -0.25 -0.50 -0.75 -1.00 - -0.00 -0.25 -0.50 -0.75 -1.00 -Standard Normal Cumulative Probability -Sample Cummulative Probability + +-0.2 +-0.1 +0.0 +0.1 +0.2 + +0.00 +0.25 +0.50 +0.75 +1.00 +Standard Normal Cumulative Probability +Sample Cummulative Probability Deviations Dots should fall along the line -Normality of Residuals +Normality of Residuals diff --git a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-qq.svg b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-qq.svg index c228daaed..7cd00cc0f 100644 --- a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-qq.svg +++ b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lm-qq.svg @@ -27,74 +27,68 @@ - - - - - - + + + + - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --3 --2 --1 -0 -1 -2 -3 +-2 +-1 +0 +1 +2 -2 -1 @@ -102,7 +96,7 @@ 1 2 Standard Normal Distribution Quantiles -Sample Quantiles +Sample Quantile Deviations Dots should fall along the line Normality of Residuals diff --git a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-fixed.svg b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-fixed.svg index 552e1f32a..8bcd7cb7a 100644 --- a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-fixed.svg +++ b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-fixed.svg @@ -18,50 +18,225 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - --100 --50 -0 -50 -100 -Residuals -Density -Distribution should be close to the normal curve + +-50 +0 +50 + +-40 +0 +40 +Standard Normal Distribution Quantiles +Sample Quantile Deviations +Dots should fall along the line Normality of Residuals diff --git a/tests/testthat/_snaps/vdiffr_geoms_coords/geom-point2-works.svg b/tests/testthat/_snaps/vdiffr_geoms_coords/geom-point2-works.svg index 9f3dded2e..3cbc69d86 100644 --- a/tests/testthat/_snaps/vdiffr_geoms_coords/geom-point2-works.svg +++ b/tests/testthat/_snaps/vdiffr_geoms_coords/geom-point2-works.svg @@ -20,6 +20,15 @@ + + + + + + + + +