diff --git a/DESCRIPTION b/DESCRIPTION index cf16d715b..57e2274f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: performance Title: Assessment of Regression Models Performance -Version: 0.12.4.17 +Version: 0.13.0 Authors@R: c(person(given = "Daniel", family = "Lüdecke", @@ -160,4 +160,3 @@ Config/Needs/website: r-lib/pkgdown, easystats/easystatstemplate Config/rcmdcheck/ignore-inconsequential-notes: true -Remotes: easystats/see diff --git a/NEWS.md b/NEWS.md index 85cb6eba5..51403233c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# performance 0.12.5 +# performance 0.13.0 ## Breaking changes diff --git a/R/binned_residuals.R b/R/binned_residuals.R index 5fb8132e4..b607f6035 100644 --- a/R/binned_residuals.R +++ b/R/binned_residuals.R @@ -68,11 +68,10 @@ #' # look at the data frame #' as.data.frame(result) #' +#' @examplesIf insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE) #' \donttest{ #' # plot -#' if (require("see")) { -#' plot(result, show_dots = TRUE) -#' } +#' plot(result, show_dots = TRUE) #' } #' #' @export diff --git a/R/check_collinearity.R b/R/check_collinearity.R index 6d34c6afa..5411e443c 100644 --- a/R/check_collinearity.R +++ b/R/check_collinearity.R @@ -133,7 +133,7 @@ #' m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) #' check_collinearity(m) #' -#' @examplesIf require("see") +#' @examplesIf insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE) #' # plot results #' x <- check_collinearity(m) #' plot(x) diff --git a/R/check_dag.R b/R/check_dag.R index c8b53533f..634358492 100644 --- a/R/check_dag.R +++ b/R/check_dag.R @@ -119,7 +119,7 @@ #' Interpreting Confounder and Modifier Coefficients. American Journal of #' Epidemiology, 177(4), 292–298. \doi{10.1093/aje/kws412} #' -#' @examplesIf require("ggdag", quietly = TRUE) && require("dagitty", quietly = TRUE) && require("see", quietly = TRUE) +#' @examplesIf all(insight::check_if_installed(c("ggdag", "dagitty", "see"), quietly = TRUE)) #' # no adjustment needed #' check_dag( #' y ~ x + b, diff --git a/R/check_distribution.R b/R/check_distribution.R index 9ab4d24de..9f2a08e9b 100644 --- a/R/check_distribution.R +++ b/R/check_distribution.R @@ -47,12 +47,12 @@ NULL #' There is a `plot()` method, which shows the probabilities of all predicted #' distributions, however, only if the probability is greater than zero. #' -#' @examplesIf require("lme4") && require("parameters") && require("randomForest") +#' @examplesIf all(insight::check_if_installed(c("lme4", "parameters", "randomForest"), quietly = TRUE)) #' data(sleepstudy, package = "lme4") #' model <<- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy) #' check_distribution(model) #' -#' @examplesIf require("see") && require("patchwork") && require("randomForest") +#' @examplesIf all(insight::check_if_installed(c("see", "patchwork", "randomForest"), quietly = TRUE)) #' plot(check_distribution(model)) #' #' @export diff --git a/R/check_heteroscedasticity.R b/R/check_heteroscedasticity.R index ad97d8871..522143552 100644 --- a/R/check_heteroscedasticity.R +++ b/R/check_heteroscedasticity.R @@ -27,10 +27,9 @@ #' check_heteroscedasticity(m) #' #' # plot results -#' if (require("see")) { -#' x <- check_heteroscedasticity(m) -#' plot(x) -#' } +#' @examplesIf insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE) +#' x <- check_heteroscedasticity(m) +#' plot(x) #' @export check_heteroscedasticity <- function(x, ...) { UseMethod("check_heteroscedasticity") diff --git a/R/check_homogeneity.R b/R/check_homogeneity.R index 43215da62..5fcdd5ded 100644 --- a/R/check_homogeneity.R +++ b/R/check_homogeneity.R @@ -26,10 +26,9 @@ #' check_homogeneity(model) #' #' # plot results -#' if (require("see")) { -#' result <- check_homogeneity(model) -#' plot(result) -#' } +#' @examplesIf insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE) +#' result <- check_homogeneity(model) +#' plot(result) #' @export check_homogeneity <- function(x, method = c("bartlett", "fligner", "levene", "auto"), ...) { UseMethod("check_homogeneity") diff --git a/R/check_normality.R b/R/check_normality.R index 9dfcf9cbf..c7ab3796a 100644 --- a/R/check_normality.R +++ b/R/check_normality.R @@ -29,7 +29,7 @@ #' standardized deviance residuals is shown (in line with changes in #' `plot.lm()` for R 4.3+). #' -#' @examplesIf require("see") +#' @examplesIf insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE) #' m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) #' check_normality(m) #' diff --git a/R/check_outliers.R b/R/check_outliers.R index 91a9e491c..88f37100c 100644 --- a/R/check_outliers.R +++ b/R/check_outliers.R @@ -335,7 +335,7 @@ #' group_iris <- datawizard::data_group(iris, "Species") #' check_outliers(group_iris) #' # nolint start -#' @examplesIf require("see") && require("bigutilsr") && require("loo") && require("MASS") && require("ICSOutlier") && require("ICS") && require("dbscan") +#' @examplesIf all(insight::check_if_installed(c("bigutilsr", "MASS", "ICSOutlier", "ICS", "dbscan", "loo", "see"), quietly = TRUE)) #' # nolint end #' \donttest{ #' # You can also run all the methods diff --git a/R/check_predictions.R b/R/check_predictions.R index 0780e35ec..5497ed6ae 100644 --- a/R/check_predictions.R +++ b/R/check_predictions.R @@ -75,7 +75,7 @@ #' - Gelman, A., Hill, J., and Vehtari, A. (2020). Regression and Other Stories. #' Cambridge University Press. #' -#' @examplesIf require("see") +#' @examplesIf insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE) #' # linear model #' model <- lm(mpg ~ disp, data = mtcars) #' check_predictions(model) diff --git a/man/binned_residuals.Rd b/man/binned_residuals.Rd index 632e2a050..885e5ff50 100644 --- a/man/binned_residuals.Rd +++ b/man/binned_residuals.Rd @@ -93,13 +93,12 @@ result # look at the data frame as.data.frame(result) +\dontshow{if (insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ # plot -if (require("see")) { - plot(result, show_dots = TRUE) +plot(result, show_dots = TRUE) } -} - +\dontshow{\}) # examplesIf} } \references{ Gelman, A., and Hill, J. (2007). Data analysis using regression and diff --git a/man/check_collinearity.Rd b/man/check_collinearity.Rd index 699695a06..54e490172 100644 --- a/man/check_collinearity.Rd +++ b/man/check_collinearity.Rd @@ -140,7 +140,7 @@ increasing lack of identifiability. The \emph{VIF proportion} column equals the m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) check_collinearity(m) -\dontshow{if (require("see")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # plot results x <- check_collinearity(m) plot(x) diff --git a/man/check_dag.Rd b/man/check_dag.Rd index e366ff07a..cd1971feb 100644 --- a/man/check_dag.Rd +++ b/man/check_dag.Rd @@ -146,7 +146,7 @@ adjustments or over-adjustment. } \examples{ -\dontshow{if (require("ggdag", quietly = TRUE) && require("dagitty", quietly = TRUE) && require("see", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("ggdag", "dagitty", "see"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # no adjustment needed check_dag( y ~ x + b, diff --git a/man/check_distribution.Rd b/man/check_distribution.Rd index cb80405d9..3870cad37 100644 --- a/man/check_distribution.Rd +++ b/man/check_distribution.Rd @@ -45,12 +45,12 @@ implemented in the \href{https://easystats.github.io/see/}{\pkg{see}-package}. } \examples{ -\dontshow{if (require("lme4") && require("parameters") && require("randomForest")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("lme4", "parameters", "randomForest"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(sleepstudy, package = "lme4") model <<- lme4::lmer(Reaction ~ Days + (Days | Subject), sleepstudy) check_distribution(model) \dontshow{\}) # examplesIf} -\dontshow{if (require("see") && require("patchwork") && require("randomForest")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("see", "patchwork", "randomForest"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} plot(check_distribution(model)) \dontshow{\}) # examplesIf} } diff --git a/man/check_heteroscedasticity.Rd b/man/check_heteroscedasticity.Rd index c5e1fba74..7fc16c9aa 100644 --- a/man/check_heteroscedasticity.Rd +++ b/man/check_heteroscedasticity.Rd @@ -36,10 +36,10 @@ m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) check_heteroscedasticity(m) # plot results -if (require("see")) { - x <- check_heteroscedasticity(m) - plot(x) -} +\dontshow{if (insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +x <- check_heteroscedasticity(m) +plot(x) +\dontshow{\}) # examplesIf} } \references{ Breusch, T. S., and Pagan, A. R. (1979) A simple test for heteroscedasticity diff --git a/man/check_homogeneity.Rd b/man/check_homogeneity.Rd index 2a9b94f02..007dec528 100644 --- a/man/check_homogeneity.Rd +++ b/man/check_homogeneity.Rd @@ -39,10 +39,10 @@ model <<- lm(len ~ supp + dose, data = ToothGrowth) check_homogeneity(model) # plot results -if (require("see")) { - result <- check_homogeneity(model) - plot(result) -} +\dontshow{if (insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +result <- check_homogeneity(model) +plot(result) +\dontshow{\}) # examplesIf} } \seealso{ Other functions to check model assumptions and and assess model quality: diff --git a/man/check_normality.Rd b/man/check_normality.Rd index 7388e0c0b..bb4ccb781 100644 --- a/man/check_normality.Rd +++ b/man/check_normality.Rd @@ -43,7 +43,7 @@ standardized residuals, are used for the test. There is also a implemented in the \href{https://easystats.github.io/see/}{\strong{see}-package}. } \examples{ -\dontshow{if (require("see")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars) check_normality(m) diff --git a/man/check_outliers.Rd b/man/check_outliers.Rd index 489dbafc3..16950d3c3 100644 --- a/man/check_outliers.Rd +++ b/man/check_outliers.Rd @@ -334,7 +334,7 @@ filtered_data <- data[outliers_info$Outlier < 0.1, ] group_iris <- datawizard::data_group(iris, "Species") check_outliers(group_iris) # nolint start -\dontshow{if (require("see") && require("bigutilsr") && require("loo") && require("MASS") && require("ICSOutlier") && require("ICS") && require("dbscan")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("bigutilsr", "MASS", "ICSOutlier", "ICS", "dbscan", "loo", "see"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # nolint end \donttest{ # You can also run all the methods diff --git a/man/check_predictions.Rd b/man/check_predictions.Rd index 5a0f0042a..8c88e2bd9 100644 --- a/man/check_predictions.Rd +++ b/man/check_predictions.Rd @@ -86,7 +86,7 @@ If \code{check_predictions()} doesn't work as expected, try setting \code{verbos to get hints about possible problems. } \examples{ -\dontshow{if (require("see")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # linear model model <- lm(mpg ~ disp, data = mtcars) check_predictions(model) diff --git a/tests/testthat/test-check_model.R b/tests/testthat/test-check_model.R index 216062a08..687a32344 100644 --- a/tests/testthat/test-check_model.R +++ b/tests/testthat/test-check_model.R @@ -1,5 +1,5 @@ skip_on_cran() -skip_if_not_installed("see") +skip_if_not_installed("see", minimum_version = "0.9.1") d <- data.frame( y = c( diff --git a/tests/testthat/test-check_overdispersion.R b/tests/testthat/test-check_overdispersion.R index 2930322bb..1af6b1327 100644 --- a/tests/testthat/test-check_overdispersion.R +++ b/tests/testthat/test-check_overdispersion.R @@ -174,7 +174,7 @@ test_that("check_overdispersion, MASS::negbin", { expect_message(capture.output(print(out)), "Underdispersion detected") # check that plot works - skip_if_not_installed("see") + skip_if_not_installed("see", minimum_version = "0.9.1") expect_s3_class(plot(out), "ggplot") })