From 9c696d3285b861300d333af709753719c0afdb9b Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 12:57:24 +0100 Subject: [PATCH 01/17] CRAN RC: 0.8.3 --- DESCRIPTION | 11 +++++------ NEWS.md | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index caae07f31..7514c90ab 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: see Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2' -Version: 0.8.2.7 +Version: 0.8.3 Authors@R: c(person(given = "Daniel", family = "Lüdecke", @@ -67,11 +67,11 @@ Imports: correlation (>= 0.8.4), datawizard (>= 0.9.1), effectsize (>= 0.8.6), - ggplot2 (>= 3.4.0), - insight (>= 0.19.8), + ggplot2 (>= 3.5.0), + insight (>= 0.19.10), modelbased (>= 0.8.7), - parameters (>= 0.21.5), - performance (>= 0.10.9) + parameters (>= 0.21.6), + performance (>= 0.11.0) Suggests: brms, curl, @@ -119,4 +119,3 @@ Config/Needs/website: r-lib/pkgdown, easystats/easystatstemplate Config/rcmdcheck/ignore-inconsequential-notes: true -Remotes: easystats/performance diff --git a/NEWS.md b/NEWS.md index 3b7cb0076..e7e513c9f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# see (development version) +# see 0.8.3 ## Major changes From 66daade1b1f5c0dcd216a67c1b958c8f21dc3b54 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 12:58:57 +0100 Subject: [PATCH 02/17] update snapshots --- R/plot.check_model.R | 1 - inst/WORDLIST | 3 - .../check-normality-works-lm-density.svg | 64 ++-- .../check-normality-works-lm-pp.svg | 64 ++-- .../check-normality-works-lm-qq.svg | 64 ++-- .../check-normality-works-lmer-fixed.svg | 360 +++++++++--------- .../check-normality-works-lmer-random.svg | 72 ++-- 7 files changed, 312 insertions(+), 316 deletions(-) diff --git a/R/plot.check_model.R b/R/plot.check_model.R index fd6fd9675..5a38379a3 100644 --- a/R/plot.check_model.R +++ b/R/plot.check_model.R @@ -177,7 +177,6 @@ plot.see_check_model <- function(x, colors = colors, detrend = detrend, style = style - ) } else { p$QQ <- .plot_diag_qq( diff --git a/inst/WORDLIST b/inst/WORDLIST index 6560f8826..7aaeeedee 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -56,18 +56,15 @@ emmeans errorbars et ffectsize -geom's geoms ggalluvial ggdist ggplot -ggproto ggpubr ggraph ggrepel ggridges ggstatsplot -glyphs grey gridExtra histodot 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 7cd00cc0f..34c905ec8 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 @@ -48,38 +48,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 1609826e5..e70a2a6d1 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 @@ -51,38 +51,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 7cd00cc0f..34c905ec8 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 @@ -48,38 +48,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 8bcd7cb7a..89b1c2c93 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 @@ -43,186 +43,186 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg index 96297ddd3..fba1b8b50 100644 --- a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg +++ b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg @@ -103,24 +103,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -205,24 +205,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + From 8db4c569d077cad8c30f0277a65e8d2497e913fe Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 13:11:46 +0100 Subject: [PATCH 03/17] suppress stan glm messages --- R/data_plot.R | 2 +- man/add_plot_attributes.Rd | 2 +- man/geom_violindot.Rd | 29 +++++++++++++++--- man/geom_violinhalf.Rd | 63 ++++++++++++++++++++++++++++++-------- 4 files changed, 77 insertions(+), 19 deletions(-) diff --git a/R/data_plot.R b/R/data_plot.R index d7ce90069..61c3e56fb 100644 --- a/R/data_plot.R +++ b/R/data_plot.R @@ -103,7 +103,7 @@ data_plot <- function(x, ...) { #' model <- suppressWarnings(stan_glm( #' Sepal.Length ~ Petal.Width + Species + Sepal.Width, #' data = iris, -#' chains = 2, iter = 200 +#' chains = 2, iter = 200, refresh = 0 #' )) #' #' result <- hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) diff --git a/man/add_plot_attributes.Rd b/man/add_plot_attributes.Rd index 9eea79a83..148c7ee85 100644 --- a/man/add_plot_attributes.Rd +++ b/man/add_plot_attributes.Rd @@ -25,7 +25,7 @@ library(ggplot2) model <- suppressWarnings(stan_glm( Sepal.Length ~ Petal.Width + Species + Sepal.Width, data = iris, - chains = 2, iter = 200 + chains = 2, iter = 200, refresh = 0 )) result <- hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) diff --git a/man/geom_violindot.Rd b/man/geom_violindot.Rd index b02b4b4cf..b7cdeee8c 100644 --- a/man/geom_violindot.Rd +++ b/man/geom_violindot.Rd @@ -68,10 +68,31 @@ Defaults to 1/30 of the range of the data} \item{position_dots}{Position adjustment for dots, either as a string, or the result of a call to a position adjustment function.} -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are -often aesthetics, used to set an aesthetic to a fixed value, like -\code{colour = "red"} or \code{size = 3}. They may also be parameters -to the paired geom/stat.} +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These +arguments broadly fall into one of 4 categories below. Notably, further +arguments to the \code{position} argument, or aesthetics that are required +can \emph{not} be passed through \code{...}. Unknown arguments that are not part +of the 4 categories below are ignored. +\itemize{ +\item Static aesthetics that are not mapped to a scale, but are at a fixed +value and apply to the layer as a whole. For example, \code{colour = "red"} +or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} +section that lists the available options. The 'required' aesthetics +cannot be passed on to the \code{params}. +\item When constructing a layer using +a \verb{stat_*()} function, the \code{...} argument can be used to pass on +parameters to the \code{geom} part of the layer. An example of this is +\code{stat_density(geom = "area", outline.type = "both")}. The geom's +documentation lists which parameters it can accept. +\item Inversely, when constructing a layer using a +\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters +to the \code{stat} part of the layer. An example of this is +\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation +lists which parameters it can accept. +\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through +\code{...}. This can be one of the functions described as +\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. +}} \item{size_dots, dots_size}{Size adjustment for dots.} diff --git a/man/geom_violinhalf.Rd b/man/geom_violinhalf.Rd index 82b68ae8e..8bf3734d2 100644 --- a/man/geom_violinhalf.Rd +++ b/man/geom_violinhalf.Rd @@ -38,15 +38,31 @@ the plot data. The return value must be a \code{data.frame}, and will be used as the layer data. A \code{function} can be created from a \code{formula} (e.g. \code{~ head(.x, 10)}).} -\item{stat}{The statistical transformation to use on the data for this -layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the -stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than -\code{"stat_count"})} - -\item{position}{Position adjustment, either as a string naming the adjustment -(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a -position adjustment function. Use the latter if you need to change the -settings of the adjustment.} +\item{stat}{The statistical transformation to use on the data for this layer. +When using a \verb{geom_*()} function to construct a layer, the \code{stat} +argument can be used the override the default coupling between geoms and +stats. The \code{stat} argument accepts the following: +\itemize{ +\item A \code{Stat} ggproto subclass, for example \code{StatCount}. +\item A string naming the stat. To give the stat as a string, strip the +function name of the \code{stat_} prefix. For example, to use \code{stat_count()}, +give the stat as \code{"count"}. +\item For more information and other ways to specify the stat, see the +\link[ggplot2:layer_stats]{layer stat} documentation. +}} + +\item{position}{A position adjustment to use on the data for this layer. This +can be used in various ways, including to prevent overplotting and +improving the display. The \code{position} argument accepts the following: +\itemize{ +\item The result of calling a position function, such as \code{position_jitter()}. +This method allows for passing extra arguments to the position. +\item A string naming the position adjustment. To give the position as a +string, strip the function name of the \code{position_} prefix. For example, +to use \code{position_jitter()}, give the position as \code{"jitter"}. +\item For more information and other ways to specify the position, see the +\link[ggplot2:layer_positions]{layer position} documentation. +}} \item{trim}{If \code{TRUE} (default), trim the tails of the violins to the range of the data. If \code{FALSE}, don't trim the tails.} @@ -72,10 +88,31 @@ rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.} -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are -often aesthetics, used to set an aesthetic to a fixed value, like -\code{colour = "red"} or \code{size = 3}. They may also be parameters -to the paired geom/stat.} +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These +arguments broadly fall into one of 4 categories below. Notably, further +arguments to the \code{position} argument, or aesthetics that are required +can \emph{not} be passed through \code{...}. Unknown arguments that are not part +of the 4 categories below are ignored. +\itemize{ +\item Static aesthetics that are not mapped to a scale, but are at a fixed +value and apply to the layer as a whole. For example, \code{colour = "red"} +or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} +section that lists the available options. The 'required' aesthetics +cannot be passed on to the \code{params}. +\item When constructing a layer using +a \verb{stat_*()} function, the \code{...} argument can be used to pass on +parameters to the \code{geom} part of the layer. An example of this is +\code{stat_density(geom = "area", outline.type = "both")}. The geom's +documentation lists which parameters it can accept. +\item Inversely, when constructing a layer using a +\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters +to the \code{stat} part of the layer. An example of this is +\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation +lists which parameters it can accept. +\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through +\code{...}. This can be one of the functions described as +\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. +}} } \description{ Create a half-violin plot. From 38449423a3421b5497f705bb0528f988b952e3f5 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 13:14:16 +0100 Subject: [PATCH 04/17] Update WORDLIST --- inst/WORDLIST | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inst/WORDLIST b/inst/WORDLIST index 7aaeeedee..6560f8826 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -56,15 +56,18 @@ emmeans errorbars et ffectsize +geom's geoms ggalluvial ggdist ggplot +ggproto ggpubr ggraph ggrepel ggridges ggstatsplot +glyphs grey gridExtra histodot From c0d80d6d29aac47b81ee9250fa94d95f3d9860ab Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 13:29:07 +0100 Subject: [PATCH 05/17] no need to run examples conditional on hard deps --- R/plot.check_heteroscedasticity.R | 2 +- R/plot.check_homogeneity.R | 2 +- R/plot.check_model.R | 2 +- R/plot.check_normality.R | 4 ++-- R/plot.check_predictions.R | 2 +- R/plot.compare_parameters.R | 2 +- R/plot.estimate_contrasts.R | 2 +- R/plot.n_factors.R | 2 +- man/plot.see_check_heteroscedasticity.Rd | 2 -- man/plot.see_check_homogeneity.Rd | 3 +-- man/plot.see_check_model.Rd | 2 +- man/plot.see_check_normality.Rd | 5 ++--- man/plot.see_compare_parameters.Rd | 2 -- man/plot.see_estimate_contrasts.Rd | 2 +- man/plot.see_n_factors.Rd | 2 +- man/print.see_performance_pp_check.Rd | 2 -- 16 files changed, 15 insertions(+), 23 deletions(-) diff --git a/R/plot.check_heteroscedasticity.R b/R/plot.check_heteroscedasticity.R index 4810537b7..9865e0784 100644 --- a/R/plot.check_heteroscedasticity.R +++ b/R/plot.check_heteroscedasticity.R @@ -9,7 +9,7 @@ #' #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' -#' @examplesIf require("performance") +#' @examples #' m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) #' result <- check_heteroscedasticity(m) #' result diff --git a/R/plot.check_homogeneity.R b/R/plot.check_homogeneity.R index 590be6900..b13404e46 100644 --- a/R/plot.check_homogeneity.R +++ b/R/plot.check_homogeneity.R @@ -7,7 +7,7 @@ #' #' @return A ggplot2-object. #' -#' @examplesIf require("performance") +#' @examples #' model <<- lm(len ~ supp + dose, data = ToothGrowth) #' result <- check_homogeneity(model) #' result diff --git a/R/plot.check_model.R b/R/plot.check_model.R index 5a38379a3..6e1a7328b 100644 --- a/R/plot.check_model.R +++ b/R/plot.check_model.R @@ -11,7 +11,7 @@ #' #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' -#' @examplesIf require("performance") && require("patchwork") +#' @examplesIf require("patchwork") #' model <- lm(qsec ~ drat + wt, data = mtcars) #' plot(check_model(model)) #' diff --git a/R/plot.check_normality.R b/R/plot.check_normality.R index 6d494420c..00ba2834d 100644 --- a/R/plot.check_normality.R +++ b/R/plot.check_normality.R @@ -26,12 +26,12 @@ #' #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' -#' @examplesIf require("performance") +#' @examples #' m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) #' result <- check_normality(m) #' plot(result) #' -#' @examplesIf require("performance") && require("qqplotr") +#' @examplesIf require("qqplotr") #' plot(result, type = "qq", detrend = TRUE) #' #' @export diff --git a/R/plot.check_predictions.R b/R/plot.check_predictions.R index 36f1e9913..ebcff0eb3 100644 --- a/R/plot.check_predictions.R +++ b/R/plot.check_predictions.R @@ -55,7 +55,7 @@ data_plot.performance_pp_check <- function(x, type = "density", ...) { #' #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' -#' @examplesIf require("performance") +#' @examples #' model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris) #' check_predictions(model) #' diff --git a/R/plot.compare_parameters.R b/R/plot.compare_parameters.R index 99b1ac775..3f9a7159e 100644 --- a/R/plot.compare_parameters.R +++ b/R/plot.compare_parameters.R @@ -14,7 +14,7 @@ #' #' @return A ggplot2-object. #' -#' @examplesIf require("insight") && require("parameters") +#' @examples #' data(iris) #' lm1 <- lm(Sepal.Length ~ Species, data = iris) #' lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) diff --git a/R/plot.estimate_contrasts.R b/R/plot.estimate_contrasts.R index 2dbfbbfeb..9670f088b 100644 --- a/R/plot.estimate_contrasts.R +++ b/R/plot.estimate_contrasts.R @@ -69,7 +69,7 @@ data_plot.estimate_contrasts <- function(x, data = NULL, ...) { #' #' @return A ggplot2-object. #' -#' @examplesIf require("modelbased") && require("emmeans") +#' @examplesIf require("emmeans") #' \donttest{ #' model <- lm(Sepal.Width ~ Species, data = iris) #' contrasts <- estimate_contrasts(model) diff --git a/R/plot.n_factors.R b/R/plot.n_factors.R index 33ef1bff5..0aea3b013 100644 --- a/R/plot.n_factors.R +++ b/R/plot.n_factors.R @@ -106,7 +106,7 @@ data_plot.n_clusters <- data_plot.n_factors #' #' @return A ggplot2-object. #' -#' @examplesIf require("parameters") && require("nFactors") +#' @examplesIf require("nFactors") #' data(mtcars) #' result <- n_factors(mtcars, type = "PCA") #' result diff --git a/man/plot.see_check_heteroscedasticity.Rd b/man/plot.see_check_heteroscedasticity.Rd index 42d5a3c17..2b7e600b0 100644 --- a/man/plot.see_check_heteroscedasticity.Rd +++ b/man/plot.see_check_heteroscedasticity.Rd @@ -22,12 +22,10 @@ The \code{plot()} method for the \code{performance::check_heteroscedasticity()} function. } \examples{ -\dontshow{if (require("performance")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) result <- check_heteroscedasticity(m) result plot(result, data = m) # data required for pkgdown -\dontshow{\}) # examplesIf} } \seealso{ See also the vignette about \href{https://easystats.github.io/performance/articles/check_model.html}{\code{check_model()}}. diff --git a/man/plot.see_check_homogeneity.Rd b/man/plot.see_check_homogeneity.Rd index 061fb7b8f..08fe3d509 100644 --- a/man/plot.see_check_homogeneity.Rd +++ b/man/plot.see_check_homogeneity.Rd @@ -22,10 +22,9 @@ The \code{plot()} method for the \code{performance::check_homogeneity()} function. } \examples{ -\dontshow{if (require("performance")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} model <<- lm(len ~ supp + dose, data = ToothGrowth) result <- check_homogeneity(model) result plot(result) -\dontshow{\}) # examplesIf} + } diff --git a/man/plot.see_check_model.Rd b/man/plot.see_check_model.Rd index ccae75b1b..50d55abe2 100644 --- a/man/plot.see_check_model.Rd +++ b/man/plot.see_check_model.Rd @@ -38,7 +38,7 @@ The \code{plot()} method for the \code{performance::check_model()} function. Diagnostic plots for regression models. } \examples{ -\dontshow{if (require("performance") && require("patchwork")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (require("patchwork")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} model <- lm(qsec ~ drat + wt, data = mtcars) plot(check_model(model)) \dontshow{\}) # examplesIf} diff --git a/man/plot.see_check_normality.Rd b/man/plot.see_check_normality.Rd index 5e6587dfc..e0bd70e1a 100644 --- a/man/plot.see_check_normality.Rd +++ b/man/plot.see_check_normality.Rd @@ -59,12 +59,11 @@ The \code{plot()} method for the \code{performance::check_normality()} function. } \examples{ -\dontshow{if (require("performance")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) result <- check_normality(m) plot(result) -\dontshow{\}) # examplesIf} -\dontshow{if (require("performance") && require("qqplotr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} + +\dontshow{if (require("qqplotr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} plot(result, type = "qq", detrend = TRUE) \dontshow{\}) # examplesIf} } diff --git a/man/plot.see_compare_parameters.Rd b/man/plot.see_compare_parameters.Rd index 5fd9f2c25..900e68406 100644 --- a/man/plot.see_compare_parameters.Rd +++ b/man/plot.see_compare_parameters.Rd @@ -59,12 +59,10 @@ The \code{plot()} method for the \code{parameters::compare_parameters()} function. } \examples{ -\dontshow{if (require("insight") && require("parameters")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) lm3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) result <- compare_parameters(lm1, lm2, lm3) plot(result) -\dontshow{\}) # examplesIf} } diff --git a/man/plot.see_estimate_contrasts.Rd b/man/plot.see_estimate_contrasts.Rd index 4c26ed4e6..05f9de8d7 100644 --- a/man/plot.see_estimate_contrasts.Rd +++ b/man/plot.see_estimate_contrasts.Rd @@ -22,7 +22,7 @@ The \code{plot()} method for the \code{modelbased::estimate_contrasts()} function. } \examples{ -\dontshow{if (require("modelbased") && require("emmeans")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (require("emmeans")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ model <- lm(Sepal.Width ~ Species, data = iris) contrasts <- estimate_contrasts(model) diff --git a/man/plot.see_n_factors.Rd b/man/plot.see_n_factors.Rd index 70c82544e..37a8a6c8d 100644 --- a/man/plot.see_n_factors.Rd +++ b/man/plot.see_n_factors.Rd @@ -31,7 +31,7 @@ A ggplot2-object. The \code{plot()} method for the \code{parameters::n_factors()} and \code{parameters::n_clusters()} } \examples{ -\dontshow{if (require("parameters") && require("nFactors")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (require("nFactors")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(mtcars) result <- n_factors(mtcars, type = "PCA") result diff --git a/man/print.see_performance_pp_check.Rd b/man/print.see_performance_pp_check.Rd index d3a319d0c..1d286d61e 100644 --- a/man/print.see_performance_pp_check.Rd +++ b/man/print.see_performance_pp_check.Rd @@ -64,7 +64,6 @@ A ggplot2-object. The \code{plot()} method for the \code{performance::check_predictions()} function. } \examples{ -\dontshow{if (require("performance")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris) check_predictions(model) @@ -78,7 +77,6 @@ model <- glm( ) out <- check_predictions(model) plot(out, type = "discrete_dots") -\dontshow{\}) # examplesIf} } \seealso{ See also the vignette about \href{https://easystats.github.io/performance/articles/check_model.html}{\code{check_model()}}. From 4a27a1ccd7826dde8912005e7a6270146bfc62ef Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 13:34:25 +0100 Subject: [PATCH 06/17] another one --- R/coord_radar.R | 2 +- man/coord_radar.Rd | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/R/coord_radar.R b/R/coord_radar.R index 909bdb7cf..ad0fd9730 100644 --- a/R/coord_radar.R +++ b/R/coord_radar.R @@ -5,7 +5,7 @@ #' @inheritParams ggplot2::coord_polar #' @param ... Other arguments to be passed to `ggproto`. #' -#' @examplesIf require("datawizard") && require("ggplot2") +#' @examples #' # Create a radar/spider chart with ggplot: #' data(iris) #' data <- aggregate(iris[-5], list(Species = iris$Species), mean) diff --git a/man/coord_radar.Rd b/man/coord_radar.Rd index e6d8e4fb2..64052975b 100644 --- a/man/coord_radar.Rd +++ b/man/coord_radar.Rd @@ -20,7 +20,6 @@ is applied clockwise or anticlockwise depending on value of \code{direction}.} Add a radar coordinate system useful for radar charts. } \examples{ -\dontshow{if (require("datawizard") && require("ggplot2")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Create a radar/spider chart with ggplot: data(iris) data <- aggregate(iris[-5], list(Species = iris$Species), mean) @@ -32,5 +31,4 @@ data <- data_to_long( ggplot(data, aes(x = name, y = value, color = Species, group = Species)) + geom_polygon(fill = NA, linewidth = 2) + coord_radar(start = -pi / 4) -\dontshow{\}) # examplesIf} } From 44e145b6e9f5e33b0783f83d3ca6a862f7105167 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 14:49:20 +0100 Subject: [PATCH 07/17] add test for ROC function --- .../plot-see-performance-roc-works.svg | 59 +++++++++++++++++++ tests/testthat/test-plot.performance_roc.R | 7 ++- 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 tests/testthat/_snaps/plot.performance_roc/plot-see-performance-roc-works.svg diff --git a/tests/testthat/_snaps/plot.performance_roc/plot-see-performance-roc-works.svg b/tests/testthat/_snaps/plot.performance_roc/plot-see-performance-roc-works.svg new file mode 100644 index 000000000..432c59bf2 --- /dev/null +++ b/tests/testthat/_snaps/plot.performance_roc/plot-see-performance-roc-works.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +1 - Specificity (False Positive Rate) +Sensitivity (True Positive Rate) +plot.see_performance_roc() works + + diff --git a/tests/testthat/test-plot.performance_roc.R b/tests/testthat/test-plot.performance_roc.R index 1873b3edf..3451c4781 100644 --- a/tests/testthat/test-plot.performance_roc.R +++ b/tests/testthat/test-plot.performance_roc.R @@ -4,12 +4,15 @@ test_that("`plot.see_performance_roc()` works", { folds <- sample(nrow(iris), size = nrow(iris) / 8, replace = FALSE) test_data <- iris[folds, ] train_data <- iris[-folds, ] - model <- glm( + model <- stats::glm( y ~ Sepal.Length + Sepal.Width, data = train_data, family = "binomial" ) result <- performance::performance_roc(model, new_data = test_data) - expect_s3_class(plot(result), "gg") + vdiffr::expect_doppelganger( + title = "plot.see_performance_roc() works", + fig = plot(result) + ) }) From f5dbd5c9577fe57ccfd3e117828a944679457d20 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 23 Mar 2024 19:50:43 +0100 Subject: [PATCH 08/17] slightly increase point size --- R/plot.check_normality.R | 2 +- R/plot.performance_simres.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/plot.check_normality.R b/R/plot.check_normality.R index 00ba2834d..db50cb6bf 100644 --- a/R/plot.check_normality.R +++ b/R/plot.check_normality.R @@ -39,7 +39,7 @@ plot.see_check_normality <- function(x, type = c("qq", "pp", "density"), data = NULL, size_line = 0.8, - size_point = 1.5, + size_point = 2, alpha = 0.2, dot_alpha = 0.8, colors = c("#3aaf85", "#1b6ca8"), diff --git a/R/plot.performance_simres.R b/R/plot.performance_simres.R index d9cb27abc..dfe488cf7 100644 --- a/R/plot.performance_simres.R +++ b/R/plot.performance_simres.R @@ -32,7 +32,7 @@ #' @export plot.see_performance_simres <- function(x, size_line = 0.8, - size_point = 1.5, + size_point = 2, alpha = 0.2, dot_alpha = 0.8, colors = c("#3aaf85", "#1b6ca8"), From 9bf433fea3d44d92a69cb164d3ff8330f5abd467 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:20:49 +0100 Subject: [PATCH 09/17] update snapshots --- .../check-normality-works-lm-density.svg | 64 ++-- .../check-normality-works-lm-pp.svg | 64 ++-- .../check-normality-works-lm-qq.svg | 64 ++-- .../check-normality-works-lmer-fixed.svg | 360 +++++++++--------- .../check-normality-works-lmer-random.svg | 72 ++-- 5 files changed, 312 insertions(+), 312 deletions(-) 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 34c905ec8..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 @@ -48,38 +48,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 e70a2a6d1..1609826e5 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 @@ -51,38 +51,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 34c905ec8..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 @@ -48,38 +48,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 89b1c2c93..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 @@ -43,186 +43,186 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg index fba1b8b50..96297ddd3 100644 --- a/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg +++ b/tests/testthat/_snaps/plot.check_normality/check-normality-works-lmer-random.svg @@ -103,24 +103,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -205,24 +205,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + From 5f68111dff34bd8c3a2792c7cb258918ddfd6eff Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:29:06 +0100 Subject: [PATCH 10/17] get rid of warnings about deprecated arg --- R/scale_color_bluebrown.R | 11 ++--------- R/scale_color_colorhex.R | 8 +------- R/scale_color_flat.R | 4 ++-- R/scale_color_material.R | 4 ++-- R/scale_color_metro.R | 4 ++-- R/scale_color_okabeito.R | 2 -- R/scale_color_pizza.R | 4 ++-- R/scale_color_see.R | 4 ++-- R/scale_color_social.R | 4 ++-- man/plot.see_check_normality.Rd | 2 +- man/plot.see_performance_simres.Rd | 2 +- 11 files changed, 17 insertions(+), 32 deletions(-) diff --git a/R/scale_color_bluebrown.R b/R/scale_color_bluebrown.R index 5eef53ff5..e0232bf49 100644 --- a/R/scale_color_bluebrown.R +++ b/R/scale_color_bluebrown.R @@ -20,7 +20,7 @@ scale_color_bluebrown <- function(palette = "contrast", discrete = TRUE, reverse pal <- palette_bluebrown(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("bluebrown_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_color_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -93,12 +93,7 @@ scale_fill_bluebrown <- function(palette = "contrast", pal <- palette_bluebrown(palette = palette, reverse = reverse) if (discrete) { - discrete_scale( - aesthetics = aesthetics, - paste0("bluebrown_", palette), - palette = pal, - ... - ) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -144,8 +139,6 @@ scale_fill_bluebrown_c <- function(palette = "contrast", # Palette -------------------------------------------------------------------- - - bluebrown_colors_list <- c( `lightblue` = "#6DC0E0", `blue` = "#5B93AE", diff --git a/R/scale_color_colorhex.R b/R/scale_color_colorhex.R index 11abd93a3..312c56bac 100644 --- a/R/scale_color_colorhex.R +++ b/R/scale_color_colorhex.R @@ -51,7 +51,6 @@ scale_color_colorhex <- function(palette = 1014416, if (discrete) { discrete_scale( aesthetics = aesthetics, - scale_name = paste0("colorhex_", pal_name), palette = pal, ... ) @@ -126,12 +125,7 @@ scale_fill_colorhex <- function(palette = 1014416, pal <- palette_colorhex(palette = palette, reverse = reverse) if (discrete) { - discrete_scale( - aesthetics = aesthetics, - paste0("colorhex_", palette), - palette = pal, - ... - ) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } diff --git a/R/scale_color_flat.R b/R/scale_color_flat.R index 8c55cd647..f6df99704 100644 --- a/R/scale_color_flat.R +++ b/R/scale_color_flat.R @@ -38,7 +38,7 @@ scale_color_flat <- function(palette = "contrast", pal <- palette_flat(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("flat_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_color_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -111,7 +111,7 @@ scale_fill_flat <- function(palette = "contrast", pal <- palette_flat(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("flat_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } diff --git a/R/scale_color_material.R b/R/scale_color_material.R index 36d32915a..a8f0f498e 100644 --- a/R/scale_color_material.R +++ b/R/scale_color_material.R @@ -35,7 +35,7 @@ scale_color_material <- function(palette = "contrast", pal <- palette_material(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("material_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_color_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -108,7 +108,7 @@ scale_fill_material <- function(palette = "contrast", pal <- palette_material(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("material_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } diff --git a/R/scale_color_metro.R b/R/scale_color_metro.R index 191f88adb..bc04ed6c4 100644 --- a/R/scale_color_metro.R +++ b/R/scale_color_metro.R @@ -35,7 +35,7 @@ scale_color_metro <- function(palette = "complement", pal <- palette_metro(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("metro_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_color_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -108,7 +108,7 @@ scale_fill_metro <- function(palette = "complement", pal <- palette_metro(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("metro_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } diff --git a/R/scale_color_okabeito.R b/R/scale_color_okabeito.R index 196efab0c..08710170e 100644 --- a/R/scale_color_okabeito.R +++ b/R/scale_color_okabeito.R @@ -60,7 +60,6 @@ scale_color_okabeito <- function(palette = "full", reverse = FALSE, order = 1:9, aesthetics = "color", ...) { discrete_scale( aesthetics = aesthetics, - paste0("okabeito_", palette), palette = palette_okabeito(palette = palette, reverse = reverse, order = order), ... ) @@ -73,7 +72,6 @@ scale_color_okabeito <- function(palette = "full", reverse = FALSE, order = 1:9, scale_fill_okabeito <- function(palette = "full", reverse = FALSE, order = 1:9, aesthetics = "fill", ...) { discrete_scale( aesthetics = aesthetics, - paste0("okabeito_", palette), palette = palette_okabeito(palette = palette, reverse = reverse, order = order), ... ) diff --git a/R/scale_color_pizza.R b/R/scale_color_pizza.R index 3d9a298ba..ecc1224ed 100644 --- a/R/scale_color_pizza.R +++ b/R/scale_color_pizza.R @@ -31,7 +31,7 @@ scale_color_pizza <- function(palette = "margherita", pal <- palette_pizza(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("pizza_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_color_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -100,7 +100,7 @@ scale_fill_pizza <- function(palette = "margherita", pal <- palette_pizza(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("pizza_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } diff --git a/R/scale_color_see.R b/R/scale_color_see.R index bdfce62aa..aa1382247 100644 --- a/R/scale_color_see.R +++ b/R/scale_color_see.R @@ -33,7 +33,7 @@ scale_color_see <- function(palette = "contrast", pal <- palette_see(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("see_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_color_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -106,7 +106,7 @@ scale_fill_see <- function(palette = "contrast", pal <- palette_see(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("see_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } diff --git a/R/scale_color_social.R b/R/scale_color_social.R index c56923238..b625d62ef 100644 --- a/R/scale_color_social.R +++ b/R/scale_color_social.R @@ -30,7 +30,7 @@ scale_color_social <- function(palette = "complement", discrete = TRUE, reverse pal <- palette_social(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("social_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_color_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } @@ -79,7 +79,7 @@ scale_fill_social <- function(palette = "complement", discrete = TRUE, reverse = pal <- palette_social(palette = palette, reverse = reverse) if (discrete) { - discrete_scale(aesthetics = aesthetics, paste0("social_", palette), palette = pal, ...) + discrete_scale(aesthetics = aesthetics, palette = pal, ...) } else { scale_fill_gradientn(colours = pal(256), aesthetics = aesthetics, ...) } diff --git a/man/plot.see_check_normality.Rd b/man/plot.see_check_normality.Rd index e0bd70e1a..a55479243 100644 --- a/man/plot.see_check_normality.Rd +++ b/man/plot.see_check_normality.Rd @@ -9,7 +9,7 @@ type = c("qq", "pp", "density"), data = NULL, size_line = 0.8, - size_point = 1.5, + size_point = 2, alpha = 0.2, dot_alpha = 0.8, colors = c("#3aaf85", "#1b6ca8"), diff --git a/man/plot.see_performance_simres.Rd b/man/plot.see_performance_simres.Rd index ce4bb25c8..f19928f72 100644 --- a/man/plot.see_performance_simres.Rd +++ b/man/plot.see_performance_simres.Rd @@ -7,7 +7,7 @@ \method{plot}{see_performance_simres}( x, size_line = 0.8, - size_point = 1.5, + size_point = 2, alpha = 0.2, dot_alpha = 0.8, colors = c("#3aaf85", "#1b6ca8"), From a1ac3796782bf32e5afe649d01596607ea444322 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:32:14 +0100 Subject: [PATCH 11/17] fix example --- R/coord_radar.R | 4 +++- man/coord_radar.Rd | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/coord_radar.R b/R/coord_radar.R index ad0fd9730..3f73e215a 100644 --- a/R/coord_radar.R +++ b/R/coord_radar.R @@ -6,10 +6,12 @@ #' @param ... Other arguments to be passed to `ggproto`. #' #' @examples +#' library(ggplot2) +#' #' # Create a radar/spider chart with ggplot: #' data(iris) #' data <- aggregate(iris[-5], list(Species = iris$Species), mean) -#' data <- data_to_long( +#' data <- datawizard::data_to_long( #' data, #' c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width") #' ) diff --git a/man/coord_radar.Rd b/man/coord_radar.Rd index 64052975b..51569bd95 100644 --- a/man/coord_radar.Rd +++ b/man/coord_radar.Rd @@ -20,10 +20,12 @@ is applied clockwise or anticlockwise depending on value of \code{direction}.} Add a radar coordinate system useful for radar charts. } \examples{ +library(ggplot2) + # Create a radar/spider chart with ggplot: data(iris) data <- aggregate(iris[-5], list(Species = iris$Species), mean) -data <- data_to_long( +data <- datawizard::data_to_long( data, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width") ) From 23608e623981f38988e96eb538021274c0d074ea Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:43:30 +0100 Subject: [PATCH 12/17] fix remaining examples --- R/data_plot.R | 2 +- R/plot.check_heteroscedasticity.R | 2 +- R/plot.compare_parameters.R | 2 +- R/plot.estimate_contrasts.R | 2 ++ R/plot.n_factors.R | 2 +- R/plot.parameters_brms_meta.R | 2 +- man/add_plot_attributes.Rd | 2 +- man/plot.see_check_heteroscedasticity.Rd | 2 +- man/plot.see_compare_parameters.Rd | 2 +- man/plot.see_estimate_contrasts.Rd | 2 ++ man/plot.see_n_factors.Rd | 2 +- man/plot.see_parameters_brms_meta.Rd | 2 +- 12 files changed, 14 insertions(+), 10 deletions(-) diff --git a/R/data_plot.R b/R/data_plot.R index 61c3e56fb..ac0f37786 100644 --- a/R/data_plot.R +++ b/R/data_plot.R @@ -106,7 +106,7 @@ data_plot <- function(x, ...) { #' chains = 2, iter = 200, refresh = 0 #' )) #' -#' result <- hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) +#' result <- bayestestR::hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) #' data <- data_plot(result, data = model) #' #' p <- ggplot( diff --git a/R/plot.check_heteroscedasticity.R b/R/plot.check_heteroscedasticity.R index 9865e0784..3a28fa9bf 100644 --- a/R/plot.check_heteroscedasticity.R +++ b/R/plot.check_heteroscedasticity.R @@ -11,7 +11,7 @@ #' #' @examples #' m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) -#' result <- check_heteroscedasticity(m) +#' result <- performance::check_heteroscedasticity(m) #' result #' plot(result, data = m) # data required for pkgdown #' @export diff --git a/R/plot.compare_parameters.R b/R/plot.compare_parameters.R index 3f9a7159e..fdc9205e6 100644 --- a/R/plot.compare_parameters.R +++ b/R/plot.compare_parameters.R @@ -19,7 +19,7 @@ #' lm1 <- lm(Sepal.Length ~ Species, data = iris) #' lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) #' lm3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) -#' result <- compare_parameters(lm1, lm2, lm3) +#' result <- parameters::compare_parameters(lm1, lm2, lm3) #' plot(result) #' @export plot.see_compare_parameters <- function(x, diff --git a/R/plot.estimate_contrasts.R b/R/plot.estimate_contrasts.R index 9670f088b..fdde59c62 100644 --- a/R/plot.estimate_contrasts.R +++ b/R/plot.estimate_contrasts.R @@ -71,6 +71,8 @@ data_plot.estimate_contrasts <- function(x, data = NULL, ...) { #' #' @examplesIf require("emmeans") #' \donttest{ +#' library(modelbased) +#' #' model <- lm(Sepal.Width ~ Species, data = iris) #' contrasts <- estimate_contrasts(model) #' means <- estimate_means(model) diff --git a/R/plot.n_factors.R b/R/plot.n_factors.R index 0aea3b013..31a265d05 100644 --- a/R/plot.n_factors.R +++ b/R/plot.n_factors.R @@ -108,7 +108,7 @@ data_plot.n_clusters <- data_plot.n_factors #' #' @examplesIf require("nFactors") #' data(mtcars) -#' result <- n_factors(mtcars, type = "PCA") +#' result <- parameters::n_factors(mtcars, type = "PCA") #' result #' #' plot(result) # type = "bar" by default diff --git a/R/plot.parameters_brms_meta.R b/R/plot.parameters_brms_meta.R index 34504d80e..00d38de4f 100644 --- a/R/plot.parameters_brms_meta.R +++ b/R/plot.parameters_brms_meta.R @@ -130,7 +130,7 @@ data_plot.parameters_brms_meta <- function(x, data = NULL, normalize_height = TR #' prior(cauchy(0, 0.5), class = sd) #' ) #' model <- suppressWarnings( -#' brm(yi | se(vi) ~ 1 + (1 | author), data = dat) +#' brm(yi | se(vi) ~ 1 + (1 | author), data = dat, refresh = 0, silent = 2) #' ) #' #' # result diff --git a/man/add_plot_attributes.Rd b/man/add_plot_attributes.Rd index 148c7ee85..77b4975cf 100644 --- a/man/add_plot_attributes.Rd +++ b/man/add_plot_attributes.Rd @@ -28,7 +28,7 @@ model <- suppressWarnings(stan_glm( chains = 2, iter = 200, refresh = 0 )) -result <- hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) +result <- bayestestR::hdi(model, ci = c(0.5, 0.75, 0.9, 0.95)) data <- data_plot(result, data = model) p <- ggplot( diff --git a/man/plot.see_check_heteroscedasticity.Rd b/man/plot.see_check_heteroscedasticity.Rd index 2b7e600b0..2bef7ecaf 100644 --- a/man/plot.see_check_heteroscedasticity.Rd +++ b/man/plot.see_check_heteroscedasticity.Rd @@ -23,7 +23,7 @@ The \code{plot()} method for the } \examples{ m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) -result <- check_heteroscedasticity(m) +result <- performance::check_heteroscedasticity(m) result plot(result, data = m) # data required for pkgdown } diff --git a/man/plot.see_compare_parameters.Rd b/man/plot.see_compare_parameters.Rd index 900e68406..c067323d5 100644 --- a/man/plot.see_compare_parameters.Rd +++ b/man/plot.see_compare_parameters.Rd @@ -63,6 +63,6 @@ data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) lm3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) -result <- compare_parameters(lm1, lm2, lm3) +result <- parameters::compare_parameters(lm1, lm2, lm3) plot(result) } diff --git a/man/plot.see_estimate_contrasts.Rd b/man/plot.see_estimate_contrasts.Rd index 05f9de8d7..0b3f295e7 100644 --- a/man/plot.see_estimate_contrasts.Rd +++ b/man/plot.see_estimate_contrasts.Rd @@ -24,6 +24,8 @@ function. \examples{ \dontshow{if (require("emmeans")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ +library(modelbased) + model <- lm(Sepal.Width ~ Species, data = iris) contrasts <- estimate_contrasts(model) means <- estimate_means(model) diff --git a/man/plot.see_n_factors.Rd b/man/plot.see_n_factors.Rd index 37a8a6c8d..c3ef4ac29 100644 --- a/man/plot.see_n_factors.Rd +++ b/man/plot.see_n_factors.Rd @@ -33,7 +33,7 @@ The \code{plot()} method for the \code{parameters::n_factors()} and \code{parame \examples{ \dontshow{if (require("nFactors")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(mtcars) -result <- n_factors(mtcars, type = "PCA") +result <- parameters::n_factors(mtcars, type = "PCA") result plot(result) # type = "bar" by default diff --git a/man/plot.see_parameters_brms_meta.Rd b/man/plot.see_parameters_brms_meta.Rd index 502f8c255..8260aa9f2 100644 --- a/man/plot.see_parameters_brms_meta.Rd +++ b/man/plot.see_parameters_brms_meta.Rd @@ -85,7 +85,7 @@ priors <- c( prior(cauchy(0, 0.5), class = sd) ) model <- suppressWarnings( - brm(yi | se(vi) ~ 1 + (1 | author), data = dat) + brm(yi | se(vi) ~ 1 + (1 | author), data = dat, refresh = 0, silent = 2) ) # result From ffced1a5631604f49aa25ff0c67cd56690fbc8b0 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:48:44 +0100 Subject: [PATCH 13/17] fix example --- R/plot.check_homogeneity.R | 2 ++ man/plot.see_check_homogeneity.Rd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/R/plot.check_homogeneity.R b/R/plot.check_homogeneity.R index b13404e46..ad3a9b313 100644 --- a/R/plot.check_homogeneity.R +++ b/R/plot.check_homogeneity.R @@ -8,6 +8,8 @@ #' @return A ggplot2-object. #' #' @examples +#' library(performance) +#' #' model <<- lm(len ~ supp + dose, data = ToothGrowth) #' result <- check_homogeneity(model) #' result diff --git a/man/plot.see_check_homogeneity.Rd b/man/plot.see_check_homogeneity.Rd index 08fe3d509..7de8e6fe2 100644 --- a/man/plot.see_check_homogeneity.Rd +++ b/man/plot.see_check_homogeneity.Rd @@ -22,6 +22,8 @@ The \code{plot()} method for the \code{performance::check_homogeneity()} function. } \examples{ +library(performance) + model <<- lm(len ~ supp + dose, data = ToothGrowth) result <- check_homogeneity(model) result From 4202921653e1d6d01278399cd2fe4239c7c891e0 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:53:43 +0100 Subject: [PATCH 14/17] another example to fix --- R/plot.check_model.R | 1 + man/plot.see_check_model.Rd | 1 + 2 files changed, 2 insertions(+) diff --git a/R/plot.check_model.R b/R/plot.check_model.R index 6e1a7328b..9aaba14e4 100644 --- a/R/plot.check_model.R +++ b/R/plot.check_model.R @@ -12,6 +12,7 @@ #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' #' @examplesIf require("patchwork") +#' library(performance) #' model <- lm(qsec ~ drat + wt, data = mtcars) #' plot(check_model(model)) #' diff --git a/man/plot.see_check_model.Rd b/man/plot.see_check_model.Rd index 50d55abe2..a6c55f6fc 100644 --- a/man/plot.see_check_model.Rd +++ b/man/plot.see_check_model.Rd @@ -39,6 +39,7 @@ Diagnostic plots for regression models. } \examples{ \dontshow{if (require("patchwork")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +library(performance) model <- lm(qsec ~ drat + wt, data = mtcars) plot(check_model(model)) \dontshow{\}) # examplesIf} From e6734bafd1def81b44e9fb2106490ad5e75519e3 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 21:58:20 +0100 Subject: [PATCH 15/17] fix example --- R/plot.check_model.R | 1 + R/plot.check_normality.R | 2 ++ man/plot.see_check_model.Rd | 1 + man/plot.see_check_normality.Rd | 2 ++ 4 files changed, 6 insertions(+) diff --git a/R/plot.check_model.R b/R/plot.check_model.R index 9aaba14e4..b6c9a32e7 100644 --- a/R/plot.check_model.R +++ b/R/plot.check_model.R @@ -13,6 +13,7 @@ #' #' @examplesIf require("patchwork") #' library(performance) +#' #' model <- lm(qsec ~ drat + wt, data = mtcars) #' plot(check_model(model)) #' diff --git a/R/plot.check_normality.R b/R/plot.check_normality.R index db50cb6bf..52536f054 100644 --- a/R/plot.check_normality.R +++ b/R/plot.check_normality.R @@ -27,6 +27,8 @@ #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' #' @examples +#' library(performance) +#' #' m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) #' result <- check_normality(m) #' plot(result) diff --git a/man/plot.see_check_model.Rd b/man/plot.see_check_model.Rd index a6c55f6fc..3609fa144 100644 --- a/man/plot.see_check_model.Rd +++ b/man/plot.see_check_model.Rd @@ -40,6 +40,7 @@ Diagnostic plots for regression models. \examples{ \dontshow{if (require("patchwork")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(performance) + model <- lm(qsec ~ drat + wt, data = mtcars) plot(check_model(model)) \dontshow{\}) # examplesIf} diff --git a/man/plot.see_check_normality.Rd b/man/plot.see_check_normality.Rd index a55479243..aa80c71ae 100644 --- a/man/plot.see_check_normality.Rd +++ b/man/plot.see_check_normality.Rd @@ -59,6 +59,8 @@ The \code{plot()} method for the \code{performance::check_normality()} function. } \examples{ +library(performance) + m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) result <- check_normality(m) plot(result) From fd3c7f4719df73f2591260003c3406a3f59a0a25 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 23 Mar 2024 22:03:42 +0100 Subject: [PATCH 16/17] fix example --- R/plot.check_predictions.R | 2 ++ man/print.see_performance_pp_check.Rd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/R/plot.check_predictions.R b/R/plot.check_predictions.R index ebcff0eb3..03af126d1 100644 --- a/R/plot.check_predictions.R +++ b/R/plot.check_predictions.R @@ -56,6 +56,8 @@ data_plot.performance_pp_check <- function(x, type = "density", ...) { #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' #' @examples +#' library(performance) +#' #' model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris) #' check_predictions(model) #' diff --git a/man/print.see_performance_pp_check.Rd b/man/print.see_performance_pp_check.Rd index 1d286d61e..0960fbbd3 100644 --- a/man/print.see_performance_pp_check.Rd +++ b/man/print.see_performance_pp_check.Rd @@ -64,6 +64,8 @@ A ggplot2-object. The \code{plot()} method for the \code{performance::check_predictions()} function. } \examples{ +library(performance) + model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris) check_predictions(model) From 83e62c4c0dd559fb39f6d2dc32ff0e63ff26705b Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sun, 24 Mar 2024 09:32:56 +0100 Subject: [PATCH 17/17] downgrade ggplot2 version --- DESCRIPTION | 2 +- man/geom_violindot.Rd | 29 +++---------------- man/geom_violinhalf.Rd | 63 +++++++++--------------------------------- 3 files changed, 18 insertions(+), 76 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7514c90ab..6df4c5225 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -67,7 +67,7 @@ Imports: correlation (>= 0.8.4), datawizard (>= 0.9.1), effectsize (>= 0.8.6), - ggplot2 (>= 3.5.0), + ggplot2 (>= 3.4.4), insight (>= 0.19.10), modelbased (>= 0.8.7), parameters (>= 0.21.6), diff --git a/man/geom_violindot.Rd b/man/geom_violindot.Rd index b7cdeee8c..b02b4b4cf 100644 --- a/man/geom_violindot.Rd +++ b/man/geom_violindot.Rd @@ -68,31 +68,10 @@ Defaults to 1/30 of the range of the data} \item{position_dots}{Position adjustment for dots, either as a string, or the result of a call to a position adjustment function.} -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These -arguments broadly fall into one of 4 categories below. Notably, further -arguments to the \code{position} argument, or aesthetics that are required -can \emph{not} be passed through \code{...}. Unknown arguments that are not part -of the 4 categories below are ignored. -\itemize{ -\item Static aesthetics that are not mapped to a scale, but are at a fixed -value and apply to the layer as a whole. For example, \code{colour = "red"} -or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} -section that lists the available options. The 'required' aesthetics -cannot be passed on to the \code{params}. -\item When constructing a layer using -a \verb{stat_*()} function, the \code{...} argument can be used to pass on -parameters to the \code{geom} part of the layer. An example of this is -\code{stat_density(geom = "area", outline.type = "both")}. The geom's -documentation lists which parameters it can accept. -\item Inversely, when constructing a layer using a -\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters -to the \code{stat} part of the layer. An example of this is -\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation -lists which parameters it can accept. -\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through -\code{...}. This can be one of the functions described as -\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. -}} +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are +often aesthetics, used to set an aesthetic to a fixed value, like +\code{colour = "red"} or \code{size = 3}. They may also be parameters +to the paired geom/stat.} \item{size_dots, dots_size}{Size adjustment for dots.} diff --git a/man/geom_violinhalf.Rd b/man/geom_violinhalf.Rd index 8bf3734d2..82b68ae8e 100644 --- a/man/geom_violinhalf.Rd +++ b/man/geom_violinhalf.Rd @@ -38,31 +38,15 @@ the plot data. The return value must be a \code{data.frame}, and will be used as the layer data. A \code{function} can be created from a \code{formula} (e.g. \code{~ head(.x, 10)}).} -\item{stat}{The statistical transformation to use on the data for this layer. -When using a \verb{geom_*()} function to construct a layer, the \code{stat} -argument can be used the override the default coupling between geoms and -stats. The \code{stat} argument accepts the following: -\itemize{ -\item A \code{Stat} ggproto subclass, for example \code{StatCount}. -\item A string naming the stat. To give the stat as a string, strip the -function name of the \code{stat_} prefix. For example, to use \code{stat_count()}, -give the stat as \code{"count"}. -\item For more information and other ways to specify the stat, see the -\link[ggplot2:layer_stats]{layer stat} documentation. -}} - -\item{position}{A position adjustment to use on the data for this layer. This -can be used in various ways, including to prevent overplotting and -improving the display. The \code{position} argument accepts the following: -\itemize{ -\item The result of calling a position function, such as \code{position_jitter()}. -This method allows for passing extra arguments to the position. -\item A string naming the position adjustment. To give the position as a -string, strip the function name of the \code{position_} prefix. For example, -to use \code{position_jitter()}, give the position as \code{"jitter"}. -\item For more information and other ways to specify the position, see the -\link[ggplot2:layer_positions]{layer position} documentation. -}} +\item{stat}{The statistical transformation to use on the data for this +layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the +stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than +\code{"stat_count"})} + +\item{position}{Position adjustment, either as a string naming the adjustment +(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a +position adjustment function. Use the latter if you need to change the +settings of the adjustment.} \item{trim}{If \code{TRUE} (default), trim the tails of the violins to the range of the data. If \code{FALSE}, don't trim the tails.} @@ -88,31 +72,10 @@ rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.} -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These -arguments broadly fall into one of 4 categories below. Notably, further -arguments to the \code{position} argument, or aesthetics that are required -can \emph{not} be passed through \code{...}. Unknown arguments that are not part -of the 4 categories below are ignored. -\itemize{ -\item Static aesthetics that are not mapped to a scale, but are at a fixed -value and apply to the layer as a whole. For example, \code{colour = "red"} -or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} -section that lists the available options. The 'required' aesthetics -cannot be passed on to the \code{params}. -\item When constructing a layer using -a \verb{stat_*()} function, the \code{...} argument can be used to pass on -parameters to the \code{geom} part of the layer. An example of this is -\code{stat_density(geom = "area", outline.type = "both")}. The geom's -documentation lists which parameters it can accept. -\item Inversely, when constructing a layer using a -\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters -to the \code{stat} part of the layer. An example of this is -\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation -lists which parameters it can accept. -\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through -\code{...}. This can be one of the functions described as -\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. -}} +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are +often aesthetics, used to set an aesthetic to a fixed value, like +\code{colour = "red"} or \code{size = 3}. They may also be parameters +to the paired geom/stat.} } \description{ Create a half-violin plot.