diff --git a/DESCRIPTION b/DESCRIPTION index 63fcbc04c..b8d418146 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: see Title: Model Visualisation Toolbox for 'easystats' and 'ggplot2' -Version: 0.8.5.6 +Version: 0.8.5.7 Authors@R: c(person(given = "Daniel", family = "Lüdecke", @@ -120,4 +120,3 @@ Config/testthat/edition: 3 Config/testthat/parallel: true Config/Needs/website: easystats/easystatstemplate Config/rcmdcheck/ignore-inconsequential-notes: true -Remotes: easystats/performance diff --git a/NEWS.md b/NEWS.md index b9abd37bf..d14e34e61 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,11 @@ - New `plot()` method for `performance::check_dag()`. +## Bug fixes + +- Fixed issue in `plot()` for `performance::check_model()` when package *qqplotr* + is not installed. + # see 0.8.5 ## Major Changes diff --git a/R/plot.performance_simres.R b/R/plot.performance_simres.R index a9c5801d6..a8d96d010 100644 --- a/R/plot.performance_simres.R +++ b/R/plot.performance_simres.R @@ -45,6 +45,7 @@ plot.see_performance_simres <- function(x, ...) { # need DHARMa to be installed insight::check_if_installed("DHARMa") + qqplotr_installed <- insight::check_if_installed("qqplotr", quietly = TRUE) # extract data, if from check_residuals if (inherits(x, "see_check_residuals")) { @@ -56,12 +57,21 @@ plot.see_performance_simres <- function(x, res <- stats::residuals(x) dp <- list(min = 0, max = 1, lower.tail = TRUE, log.p = FALSE) dp_band <- list(min = 0, max = 1) - dfun <- "unif" + # "distribution" argument has different handling in qqplotr + if (qqplotr_installed) { + dfun <- "unif" + } else { + dfun <- stats::qunif + } } else if (identical(transform, stats::qnorm)) { res <- stats::residuals(x, quantileFunction = stats::qnorm) dp <- list(mean = 0, sd = 1) dp_band <- list(mean = 0, sd = 1) - dfun <- "norm" + if (qqplotr_installed) { + dfun <- "norm" + } else { + dfun <- stats::qnorm + } } else if (is.character(transform)) { insight::format_error("`transform` must be a function, not a string value.") } else { @@ -76,7 +86,7 @@ plot.see_performance_simres <- function(x, ) # when we have package qqplotr, we can add confidence bands - if (requireNamespace("qqplotr", quietly = TRUE)) { + if (qqplotr_installed) { qq_stuff <- list( qqplotr::stat_qq_band( distribution = dfun,