diff --git a/DESCRIPTION b/DESCRIPTION index caae07f31..6df4c5225 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.4.4), + 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 diff --git a/R/coord_radar.R b/R/coord_radar.R index 909bdb7cf..3f73e215a 100644 --- a/R/coord_radar.R +++ b/R/coord_radar.R @@ -5,11 +5,13 @@ #' @inheritParams ggplot2::coord_polar #' @param ... Other arguments to be passed to `ggproto`. #' -#' @examplesIf require("datawizard") && require("ggplot2") +#' @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/R/data_plot.R b/R/data_plot.R index d7ce90069..ac0f37786 100644 --- a/R/data_plot.R +++ b/R/data_plot.R @@ -103,10 +103,10 @@ 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)) +#' 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 4810537b7..3a28fa9bf 100644 --- a/R/plot.check_heteroscedasticity.R +++ b/R/plot.check_heteroscedasticity.R @@ -9,9 +9,9 @@ #' #' @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 <- performance::check_heteroscedasticity(m) #' result #' plot(result, data = m) # data required for pkgdown #' @export diff --git a/R/plot.check_homogeneity.R b/R/plot.check_homogeneity.R index 590be6900..ad3a9b313 100644 --- a/R/plot.check_homogeneity.R +++ b/R/plot.check_homogeneity.R @@ -7,7 +7,9 @@ #' #' @return A ggplot2-object. #' -#' @examplesIf require("performance") +#' @examples +#' library(performance) +#' #' 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 fd6fd9675..b6c9a32e7 100644 --- a/R/plot.check_model.R +++ b/R/plot.check_model.R @@ -11,7 +11,9 @@ #' #' @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") +#' library(performance) +#' #' model <- lm(qsec ~ drat + wt, data = mtcars) #' plot(check_model(model)) #' @@ -177,7 +179,6 @@ plot.see_check_model <- function(x, colors = colors, detrend = detrend, style = style - ) } else { p$QQ <- .plot_diag_qq( diff --git a/R/plot.check_normality.R b/R/plot.check_normality.R index 6d494420c..52536f054 100644 --- a/R/plot.check_normality.R +++ b/R/plot.check_normality.R @@ -26,12 +26,14 @@ #' #' @seealso See also the vignette about [`check_model()`](https://easystats.github.io/performance/articles/check_model.html). #' -#' @examplesIf require("performance") +#' @examples +#' library(performance) +#' #' 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 @@ -39,7 +41,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.check_predictions.R b/R/plot.check_predictions.R index 36f1e9913..03af126d1 100644 --- a/R/plot.check_predictions.R +++ b/R/plot.check_predictions.R @@ -55,7 +55,9 @@ 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 +#' library(performance) +#' #' 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..fdc9205e6 100644 --- a/R/plot.compare_parameters.R +++ b/R/plot.compare_parameters.R @@ -14,12 +14,12 @@ #' #' @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) #' 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 2dbfbbfeb..fdde59c62 100644 --- a/R/plot.estimate_contrasts.R +++ b/R/plot.estimate_contrasts.R @@ -69,8 +69,10 @@ data_plot.estimate_contrasts <- function(x, data = NULL, ...) { #' #' @return A ggplot2-object. #' -#' @examplesIf require("modelbased") && require("emmeans") +#' @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 33ef1bff5..31a265d05 100644 --- a/R/plot.n_factors.R +++ b/R/plot.n_factors.R @@ -106,9 +106,9 @@ 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 <- 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/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"), 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/add_plot_attributes.Rd b/man/add_plot_attributes.Rd index 9eea79a83..77b4975cf 100644 --- a/man/add_plot_attributes.Rd +++ b/man/add_plot_attributes.Rd @@ -25,10 +25,10 @@ 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)) +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/coord_radar.Rd b/man/coord_radar.Rd index e6d8e4fb2..51569bd95 100644 --- a/man/coord_radar.Rd +++ b/man/coord_radar.Rd @@ -20,11 +20,12 @@ 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} +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") ) @@ -32,5 +33,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} } diff --git a/man/plot.see_check_heteroscedasticity.Rd b/man/plot.see_check_heteroscedasticity.Rd index 42d5a3c17..2bef7ecaf 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 <- performance::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..7de8e6fe2 100644 --- a/man/plot.see_check_homogeneity.Rd +++ b/man/plot.see_check_homogeneity.Rd @@ -22,10 +22,11 @@ The \code{plot()} method for the \code{performance::check_homogeneity()} function. } \examples{ -\dontshow{if (require("performance")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +library(performance) + 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..3609fa144 100644 --- a/man/plot.see_check_model.Rd +++ b/man/plot.see_check_model.Rd @@ -38,7 +38,9 @@ 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} +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 5e6587dfc..aa80c71ae 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"), @@ -59,12 +59,13 @@ The \code{plot()} method for the \code{performance::check_normality()} function. } \examples{ -\dontshow{if (require("performance")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +library(performance) + 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..c067323d5 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) +result <- parameters::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..0b3f295e7 100644 --- a/man/plot.see_estimate_contrasts.Rd +++ b/man/plot.see_estimate_contrasts.Rd @@ -22,8 +22,10 @@ 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{ +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 70c82544e..c3ef4ac29 100644 --- a/man/plot.see_n_factors.Rd +++ b/man/plot.see_n_factors.Rd @@ -31,9 +31,9 @@ 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 <- 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 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"), diff --git a/man/print.see_performance_pp_check.Rd b/man/print.see_performance_pp_check.Rd index d3a319d0c..0960fbbd3 100644 --- a/man/print.see_performance_pp_check.Rd +++ b/man/print.see_performance_pp_check.Rd @@ -64,7 +64,8 @@ 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} +library(performance) + model <- lm(Sepal.Length ~ Species * Petal.Width + Petal.Length, data = iris) check_predictions(model) @@ -78,7 +79,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()}}. 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) + ) })