From c7c7c8ad1555f8e06419849e19f9391f5f01de41 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 13 Dec 2024 16:22:54 +0100 Subject: [PATCH] shorter if-condition --- R/adjust.R | 2 +- R/data_to_long.R | 2 +- man/adjust.Rd | 2 +- man/data_to_long.Rd | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/adjust.R b/R/adjust.R index 9cd5805e9..8c1b1d2ac 100644 --- a/R/adjust.R +++ b/R/adjust.R @@ -30,7 +30,7 @@ #' #' @return A data frame comparable to `data`, with adjusted variables. #' -#' @examplesIf require("bayestestR", quietly = TRUE) && require("rstanarm", quietly = TRUE) && require("gamm4", quietly = TRUE) +#' @examplesIf all(insight::check_if_installed(c("bayestestR", "rstanarm", "gamm4"), quietly = TRUE)) #' adjusted_all <- adjust(attitude) #' head(adjusted_all) #' adjusted_one <- adjust(attitude, effect = "complaints", select = "rating") diff --git a/R/data_to_long.R b/R/data_to_long.R index 44a9ece5a..c44a8d3ca 100644 --- a/R/data_to_long.R +++ b/R/data_to_long.R @@ -62,7 +62,7 @@ #' @return If a tibble was provided as input, `reshape_longer()` also returns a #' tibble. Otherwise, it returns a data frame. #' -#' @examplesIf requireNamespace("psych") && requireNamespace("tidyr") +#' @examplesIf all(insight::check_if_installed(c("psych", "tidyr"), quietly = TRUE)) #' wide_data <- setNames( #' data.frame(replicate(2, rnorm(8))), #' c("Time1", "Time2") diff --git a/man/adjust.Rd b/man/adjust.Rd index c47606ce0..c1358a31d 100644 --- a/man/adjust.Rd +++ b/man/adjust.Rd @@ -124,7 +124,7 @@ Note that a regular correlation between two "adjusted" variables is equivalent to the partial correlation between them. } \examples{ -\dontshow{if (require("bayestestR", quietly = TRUE) && require("rstanarm", quietly = TRUE) && require("gamm4", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("bayestestR", "rstanarm", "gamm4"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} adjusted_all <- adjust(attitude) head(adjusted_all) adjusted_one <- adjust(attitude, effect = "complaints", select = "rating") diff --git a/man/data_to_long.Rd b/man/data_to_long.Rd index 36a474b83..4a05e735b 100644 --- a/man/data_to_long.Rd +++ b/man/data_to_long.Rd @@ -155,7 +155,7 @@ names, that identify the source of the gathered values, stored in one or more new columns (\code{names_to}). } \examples{ -\dontshow{if (requireNamespace("psych") && requireNamespace("tidyr")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (all(insight::check_if_installed(c("psych", "tidyr"), quietly = TRUE))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} wide_data <- setNames( data.frame(replicate(2, rnorm(8))), c("Time1", "Time2")