From d02f048c8fcf90000e92a3c34df8ce8f73ed363c Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Sat, 7 Dec 2024 21:55:54 +0200 Subject: [PATCH] lintr --- R/convert_between_d_to_r.R | 2 +- R/interpret_bf.R | 8 +- R/interpret_direction.R | 8 +- R/interpret_oddsratio.R | 4 +- R/interpret_rope.R | 2 +- man/interpret_direction.Rd | 1 + man/interpret_oddsratio.Rd | 4 +- man/interpret_rope.Rd | 6 +- tests/testthat/test-interpret.R | 156 ++++++++++++++++---------------- 9 files changed, 99 insertions(+), 92 deletions(-) diff --git a/R/convert_between_d_to_r.R b/R/convert_between_d_to_r.R index 6217e3eca..0921e34ff 100644 --- a/R/convert_between_d_to_r.R +++ b/R/convert_between_d_to_r.R @@ -72,7 +72,7 @@ r_to_d <- function(r, n1, n2, ...) { #' @rdname d_to_r #' @export oddsratio_to_d <- function(OR, p0, log = FALSE, ...) { - if (missing(p0)) { + if (missing(p0) || !is.numeric(p0)) { # Use approximation if (log) { log_OR <- OR diff --git a/R/interpret_bf.R b/R/interpret_bf.R index 95cfc586d..78c580a01 100644 --- a/R/interpret_bf.R +++ b/R/interpret_bf.R @@ -73,15 +73,15 @@ interpret_bf <- function(bf, interpretation[bf == 0] <- "no" # interpret direction - dir <- interpret(bf, rules(0, c("against", "in favour of"))) - dir[bf == 0] <- "against or in favour of" + direction <- interpret(bf, rules(0, c("against", "in favour of"))) + direction[bf == 0] <- "against or in favour of" # Format text if (include_value) { bf_fmt <- insight::format_bf(exp(bf), protect_ratio = protect_ratio, exact = exact) - interpretation[] <- sprintf("%s evidence (%s) %s", interpretation, bf_fmt, dir) + interpretation[] <- sprintf("%s evidence (%s) %s", interpretation, bf_fmt, direction) } else { - interpretation[] <- paste0(interpretation, " evidence ", dir) + interpretation[] <- paste0(interpretation, " evidence ", direction) } interpretation[is.na(bf)] <- "" diff --git a/R/interpret_direction.R b/R/interpret_direction.R index a1baf7bd7..4b0fc4269 100644 --- a/R/interpret_direction.R +++ b/R/interpret_direction.R @@ -6,9 +6,15 @@ #' @examples #' interpret_direction(.02) #' interpret_direction(c(.5, -.02)) +#' interpret_direction(0) #' #' @keywords interpreters #' @export interpret_direction <- function(x) { - interpret(x, rules(0, c("negative", "positive"), name = "math", right = FALSE)) + interpret(x, rules(0, c("negative", "positive"), name = "math", right = FALSE), + transform = function(.x) { + s <- sign(.x) + replace(s, s == 0, NA_real_) + } + ) } diff --git a/R/interpret_oddsratio.R b/R/interpret_oddsratio.R index 99bd00119..8c65906e6 100644 --- a/R/interpret_oddsratio.R +++ b/R/interpret_oddsratio.R @@ -4,7 +4,7 @@ #' @param rules If `"cohen1988"` (default), `OR` is transformed to a #' standardized difference (via [oddsratio_to_d()]) and interpreted according #' to Cohen's rules (see [interpret_cohens_d()]; see Chen et al., 2010). If a -#' custom set of [rules()] is used, OR is interperted as is. +#' custom set of [rules()] is used, OR is interpreted as is. #' @param log Are the provided values log odds ratio. #' @inheritParams interpret #' @inheritParams oddsratio_to_d @@ -37,7 +37,7 @@ #' #' @keywords interpreters #' @export -interpret_oddsratio <- function(OR, rules = "cohen1988", p0, log = FALSE, ...) { +interpret_oddsratio <- function(OR, rules = "cohen1988", p0 = NULL, log = FALSE, ...) { if (is.character(rules) && rules == "cohen1988") { d <- oddsratio_to_d(OR, p0, log = log) return(interpret_cohens_d(d, rules = rules)) diff --git a/R/interpret_rope.R b/R/interpret_rope.R index e2bde54df..2ae5c88f4 100644 --- a/R/interpret_rope.R +++ b/R/interpret_rope.R @@ -29,7 +29,7 @@ #' #' @keywords interpreters #' @export -interpret_rope <- function(rope, ci = 0.9, rules = "default") { +interpret_rope <- function(rope, rules = "default", ci = 0.9) { if (ci < 1) { e <- .Machine$double.eps diff --git a/man/interpret_direction.Rd b/man/interpret_direction.Rd index 07a486fcf..addbfe15e 100644 --- a/man/interpret_direction.Rd +++ b/man/interpret_direction.Rd @@ -15,6 +15,7 @@ Interpret Direction \examples{ interpret_direction(.02) interpret_direction(c(.5, -.02)) +interpret_direction(0) } \keyword{interpreters} diff --git a/man/interpret_oddsratio.Rd b/man/interpret_oddsratio.Rd index 68c998010..b69842fdc 100644 --- a/man/interpret_oddsratio.Rd +++ b/man/interpret_oddsratio.Rd @@ -4,7 +4,7 @@ \alias{interpret_oddsratio} \title{Interpret Odds Ratio} \usage{ -interpret_oddsratio(OR, rules = "cohen1988", p0, log = FALSE, ...) +interpret_oddsratio(OR, rules = "cohen1988", p0 = NULL, log = FALSE, ...) } \arguments{ \item{OR}{Value or vector of (log) odds ratio values.} @@ -12,7 +12,7 @@ interpret_oddsratio(OR, rules = "cohen1988", p0, log = FALSE, ...) \item{rules}{If \code{"cohen1988"} (default), \code{OR} is transformed to a standardized difference (via \code{\link[=oddsratio_to_d]{oddsratio_to_d()}}) and interpreted according to Cohen's rules (see \code{\link[=interpret_cohens_d]{interpret_cohens_d()}}; see Chen et al., 2010). If a -custom set of \code{\link[=rules]{rules()}} is used, OR is interperted as is.} +custom set of \code{\link[=rules]{rules()}} is used, OR is interpreted as is.} \item{p0}{Baseline risk. If not specified, the \emph{d} to \emph{OR} conversion uses am approximation (see details).} diff --git a/man/interpret_rope.Rd b/man/interpret_rope.Rd index 4bf678ccc..1301cdad7 100644 --- a/man/interpret_rope.Rd +++ b/man/interpret_rope.Rd @@ -4,14 +4,14 @@ \alias{interpret_rope} \title{Interpret Bayesian Posterior Percentage in ROPE.} \usage{ -interpret_rope(rope, ci = 0.9, rules = "default") +interpret_rope(rope, rules = "default", ci = 0.9) } \arguments{ \item{rope}{Value or vector of percentages in ROPE.} -\item{ci}{The Credible Interval (CI) probability, corresponding to the proportion of HDI, that was used. Can be \code{1} in the case of "full ROPE".} - \item{rules}{A character string (see details) or a custom set of \code{\link[=rules]{rules()}}.} + +\item{ci}{The Credible Interval (CI) probability, corresponding to the proportion of HDI, that was used. Can be \code{1} in the case of "full ROPE".} } \description{ Interpretation of diff --git a/tests/testthat/test-interpret.R b/tests/testthat/test-interpret.R index a8f178f13..2eff82a83 100644 --- a/tests/testthat/test-interpret.R +++ b/tests/testthat/test-interpret.R @@ -1,14 +1,14 @@ # interpret generic ---- test_that("interpret generic", { rules_grid <- rules(c(0.01, 0.05), c("very significant", "significant", "not significant")) - expect_equal(interpret(0.001, rules_grid)[1], "very significant") - expect_equal(interpret(0.021, rules_grid)[1], "significant") - expect_equal(interpret(0.08, rules_grid)[1], "not significant") - expect_equal( + expect_identical(interpret(0.001, rules_grid)[1], "very significant") + expect_identical(interpret(0.021, rules_grid)[1], "significant") + expect_identical(interpret(0.08, rules_grid)[1], "not significant") + expect_identical( interpret(c(0.01, 0.005, 0.08), rules_grid)[1:3], c("very significant", "very significant", "not significant") ) - expect_error(rules(c(0.5), c("A", "B", "C")), "Too many") + expect_error(rules(0.5, c("A", "B", "C")), "Too many") expect_error(rules(c(0.5, 0.2, 0.7), c("A", "B", "C", "D")), "sorted") expect_error(rules(1), NA) @@ -28,8 +28,8 @@ test_that("interpret matrix / array", { r <- cor(mtcars[, 8:11]) out <- interpret_r(r) - expect_equal(dim(out), dim(r)) - expect_equal(dimnames(out), dimnames(r)) + expect_identical(dim(out), dim(r)) + expect_identical(dimnames(out), dimnames(r)) out2 <- interpret_r(as.vector(r)) expect_equal(out2, as.vector(out), ignore_attr = TRUE) @@ -39,7 +39,7 @@ test_that("interpret matrix / array", { p <- array(runif(3 * 2 * 4, max = 0.1), dim = c(3, 2, 4)) out <- interpret_p(p, rules = "rss") - expect_equal(dim(out), dim(p)) + expect_identical(dim(out), dim(p)) out2 <- interpret_p(as.vector(p), rules = "rss") expect_equal(out2, as.vector(out), ignore_attr = TRUE) @@ -47,54 +47,54 @@ test_that("interpret matrix / array", { # interpret types ---- test_that("interpret_r", { - expect_equal(interpret_r(0.21)[1], "medium") - expect_equal(interpret_r(0.21, "cohen1988")[1], "small") - expect_equal(interpret_r(0.21, "lovakov2021")[1], "small") - expect_equal(interpret_r(0.7, "evans1996")[1], "strong") - expect_equal(interpret_r(c(0.5, -0.08), "cohen1988")[1:2], c("large", "very small")) - expect_equal(interpret_r(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_r(0.21)[1], "medium") + expect_identical(interpret_r(0.21, "cohen1988")[1], "small") + expect_identical(interpret_r(0.21, "lovakov2021")[1], "small") + expect_identical(interpret_r(0.7, "evans1996")[1], "strong") + expect_identical(interpret_r(c(0.5, -0.08), "cohen1988")[1:2], c("large", "very small")) + expect_identical(interpret_r(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_r(0.6, "DUPA"), "must be") }) test_that("interpret_p", { - expect_equal(interpret_p(0.021)[1], "significant") - expect_equal(interpret_p(0.08)[1], "not significant") - expect_equal(interpret_p(c(0.01, 0.08))[1:2], c("significant", "not significant")) - expect_equal(interpret_p(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_p(0.021)[1], "significant") + expect_identical(interpret_p(0.08)[1], "not significant") + expect_identical(interpret_p(c(0.01, 0.08))[1:2], c("significant", "not significant")) + expect_identical(interpret_p(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_p(0.6, "DUPA"), "must be") }) test_that("interpret_direction", { - expect_equal(interpret_direction(c(0.01, -0.08))[1:2], c("positive", "negative")) + expect_identical(interpret_direction(c(0.01, -0.08))[1:2], c("positive", "negative")) }) test_that("interpret_cohens_d", { - expect_equal(interpret_cohens_d(0.021)[1], "very small") - expect_equal(interpret_cohens_d(1.3, "sawilowsky2009")[1], "very large") - expect_equal(interpret_cohens_d(c(0.45, 0.85), "cohen1988")[1:2], c("small", "large")) - expect_equal(interpret_cohens_d(c(0.45, 0.85), "lovakov2021")[1:2], c("medium", "large")) - expect_equal(interpret_cohens_d(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_cohens_d(0.021)[1], "very small") + expect_identical(interpret_cohens_d(1.3, "sawilowsky2009")[1], "very large") + expect_identical(interpret_cohens_d(c(0.45, 0.85), "cohen1988")[1:2], c("small", "large")) + expect_identical(interpret_cohens_d(c(0.45, 0.85), "lovakov2021")[1:2], c("medium", "large")) + expect_identical(interpret_cohens_d(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_cohens_d(0.6, "DUPA"), "must be") }) test_that("interpret_cohens_g", { - expect_equal(interpret_cohens_g(0.021)[1], "very small") - expect_equal(interpret_cohens_g(c(0.10, 0.35), "cohen1988")[1:2], c("small", "large")) - expect_equal(interpret_cohens_g(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_cohens_g(0.021)[1], "very small") + expect_identical(interpret_cohens_g(c(0.10, 0.35), "cohen1988")[1:2], c("small", "large")) + expect_identical(interpret_cohens_g(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_cohens_g(0.6, "DUPA"), "must be") }) test_that("interpret_rope", { - expect_equal(interpret_rope(0, ci = 0.9)[1], "significant") - expect_equal(interpret_rope(c(0.50, 1), ci = 0.9)[1:2], c("undecided", "negligible")) - expect_equal(interpret_rope(c(0.98, 0.991), ci = 1)[1:2], c("probably negligible", "negligible")) - expect_equal(interpret_rope(0.6, , rules(c(0.5), c("A", "B")))[1], "B") - expect_error(interpret_rope(0.6, , "DUPA"), "must be") + expect_identical(interpret_rope(0, ci = 0.9)[1], "significant") + expect_identical(interpret_rope(c(0.50, 1), ci = 0.9)[1:2], c("undecided", "negligible")) + expect_identical(interpret_rope(c(0.98, 0.991), ci = 1)[1:2], c("probably negligible", "negligible")) + expect_identical(interpret_rope(0.6, rules(0.5, c("A", "B")))[1], "B") + expect_error(interpret_rope(0.6, "DUPA"), "must be") }) @@ -113,32 +113,32 @@ test_that("interpret_oddsratio", { test_that("interpret_r2", { - expect_equal(interpret_r2(0.4)[1], "substantial") - expect_equal(interpret_r2(c(0, 0.4), "falk1992")[1:2], c("negligible", "adequate")) - expect_equal(interpret_r2(c(0.1, 0.4), "chin1998")[1:2], c("very weak", "moderate")) - expect_equal(interpret_r2(c(0.1, 0.4), "hair2011")[1:2], c("very weak", "weak")) - expect_equal(interpret_r2(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_r2(0.4)[1], "substantial") + expect_identical(interpret_r2(c(0, 0.4), "falk1992")[1:2], c("negligible", "adequate")) + expect_identical(interpret_r2(c(0.1, 0.4), "chin1998")[1:2], c("very weak", "moderate")) + expect_identical(interpret_r2(c(0.1, 0.4), "hair2011")[1:2], c("very weak", "weak")) + expect_identical(interpret_r2(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_r2(0.6, "DUPA"), "must be") }) test_that("interpret_bf", { expect_error(interpret_bf(-2), "Negative") - expect_equal(interpret_bf(1)[1], "no evidence against or in favour of") - expect_equal( + expect_identical(interpret_bf(1)[1], "no evidence against or in favour of") + expect_identical( interpret_bf(c(0.8, 3.5), "jeffreys1961")[1:2], c("anecdotal evidence against", "moderate evidence in favour of") ) - expect_equal( + expect_identical( interpret_bf(c(0.8, 3.5), "raftery1995")[1:2], c("weak evidence against", "positive evidence in favour of") ) - expect_equal(interpret_bf(2, rules(c(0.5), c("A", "B")))[1], "B evidence in favour of") + expect_identical(interpret_bf(2, rules(0.5, c("A", "B")))[1], "B evidence in favour of") expect_error(interpret_bf(2, "DUPA"), "must be") skip_on_cran() # just in case there are changes in insight bf <- c(10^seq(-4, 4), NA) - expect_equal(interpret_bf(bf, include_value = TRUE, protect_ratio = TRUE, exact = TRUE), + expect_identical(interpret_bf(bf, include_value = TRUE, protect_ratio = TRUE, exact = TRUE), c( "extreme evidence (BF = 1/1.00e+04) against", "extreme evidence (BF = 1/1000.00) against", "very strong evidence (BF = 1/100.00) against", "moderate evidence (BF = 1/10.00) against", @@ -153,61 +153,61 @@ test_that("interpret_bf", { test_that("interpret_omega_squared", { - expect_equal(interpret_omega_squared(0.1)[1], "medium") - expect_equal(interpret_omega_squared(c(0.1, 0.25))[1:2], c("medium", "large")) - expect_equal(interpret_omega_squared(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_omega_squared(0.1)[1], "medium") + expect_identical(interpret_omega_squared(c(0.1, 0.25))[1:2], c("medium", "large")) + expect_identical(interpret_omega_squared(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_omega_squared(0.6, "DUPA"), "must be") # these should be same - expect_equal(interpret_eta_squared(0.1)[1], interpret_omega_squared(0.1)[1]) - expect_equal( + expect_identical(interpret_eta_squared(0.1)[1], interpret_omega_squared(0.1)[1]) + expect_identical( interpret_eta_squared(c(0.1, 0.25))[1:2], interpret_omega_squared(c(0.1, 0.25))[1:2] ) }) test_that("interpret_kendalls_w", { - expect_equal(interpret_kendalls_w(0.1)[1], "slight agreement") - expect_equal( + expect_identical(interpret_kendalls_w(0.1)[1], "slight agreement") + expect_identical( interpret_kendalls_w(c(0.1, 0.25))[1:2], c("slight agreement", "fair agreement") ) - expect_equal(interpret_kendalls_w(0.9)[1], "almost perfect agreement") - expect_equal(interpret_kendalls_w(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_kendalls_w(0.9)[1], "almost perfect agreement") + expect_identical(interpret_kendalls_w(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_kendalls_w(0.6, "DUPA"), "must be") }) test_that("interpret_rhat", { - expect_equal(interpret_rhat(1)[1], "converged") - expect_equal(interpret_rhat(c(1, 1.02))[1:2], c("converged", "failed")) - expect_equal(interpret_rhat(c(1, 1.02), "gelman1992")[1:2], c("converged", "converged")) - expect_equal(interpret_rhat(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_rhat(1)[1], "converged") + expect_identical(interpret_rhat(c(1, 1.02))[1:2], c("converged", "failed")) + expect_identical(interpret_rhat(c(1, 1.02), "gelman1992")[1:2], c("converged", "converged")) + expect_identical(interpret_rhat(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_rhat(0.6, "DUPA"), "must be") }) test_that("interpret_ess", { - expect_equal(interpret_ess(1000)[1], "sufficient") - expect_equal(interpret_ess(c(1000, 800))[1:2], c("sufficient", "insufficient")) - expect_equal(interpret_ess(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_ess(1000)[1], "sufficient") + expect_identical(interpret_ess(c(1000, 800))[1:2], c("sufficient", "insufficient")) + expect_identical(interpret_ess(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_ess(0.6, "DUPA"), "must be") }) test_that("interpret_fit", { - expect_equal(interpret_gfi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_agfi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_nfi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_nnfi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_cfi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_rfi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_ifi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_pnfi(c(.5, .99)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_rmsea(c(.1, .05)), c("poor", "satisfactory"), ignore_attr = TRUE) - expect_equal(interpret_srmr(c(.1, .05)), c("poor", "satisfactory"), ignore_attr = TRUE) - - cr <- rules(c(0.5), c("A", "B")) + expect_equal(interpret_gfi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_agfi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_nfi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_nnfi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_cfi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_rfi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_ifi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_pnfi(c(0.5, 0.99)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_rmsea(c(0.1, 0.05)), c("poor", "satisfactory"), ignore_attr = TRUE) + expect_equal(interpret_srmr(c(0.1, 0.05)), c("poor", "satisfactory"), ignore_attr = TRUE) + + cr <- rules(0.5, c("A", "B")) expect_equal(interpret_gfi(0.6, cr), "B", ignore_attr = TRUE) expect_equal(interpret_agfi(0.6, cr), "B", ignore_attr = TRUE) expect_equal(interpret_nfi(0.6, cr), "B", ignore_attr = TRUE) @@ -239,29 +239,29 @@ test_that("interpret_fit", { dem60 ~ ind60 " model <- lavaan::sem(structure, data = lavaan::PoliticalDemocracy) int <- interpret(model) - expect_equal(int$Name, c("GFI", "AGFI", "NFI", "NNFI", "CFI", "RMSEA", "SRMR", "RFI", "PNFI", "IFI")) + expect_identical(int$Name, c("GFI", "AGFI", "NFI", "NNFI", "CFI", "RMSEA", "SRMR", "RFI", "PNFI", "IFI")) expect_equal(int$Value, c(0.9666, 0.9124, 0.9749, 1.0001, 1, 0, 0.0273, 0.9529, 0.5199, 1.0001), tolerance = 0.001) int2 <- interpret(performance::model_performance(model)) - expect_equal(int, int2) + expect_identical(int, int2) }) test_that("interpret_icc", { expect_equal(interpret_icc(c(0.45, 0.55, 0.8, 0.95)), c("poor", "moderate", "good", "excellent"), ignore_attr = TRUE) - expect_equal(interpret_icc(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_icc(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_icc(0.6, "DUPA"), "must be") }) test_that("interpret_vif", { expect_equal(interpret_vif(c(1, 5.5, 10)), c("low", "moderate", "high"), ignore_attr = TRUE) - expect_equal(interpret_icc(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_icc(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_icc(0.6, "DUPA"), "must be") }) test_that("interpret_pd", { expect_equal(interpret_pd(c(0.9, 0.99)), c("not significant", "significant"), ignore_attr = TRUE) expect_equal(interpret_pd(c(0.9, 0.99), "makowski2019"), c("uncertain", "likely existing"), ignore_attr = TRUE) - expect_equal(interpret_pd(0.6, rules(c(0.5), c("A", "B")))[1], "B") + expect_identical(interpret_pd(0.6, rules(0.5, c("A", "B")))[1], "B") expect_error(interpret_pd(0.6, "DUPA"), "must be") }) @@ -289,7 +289,7 @@ test_that("interpret effectsize_table", { d1_ <- interpret(d1, rules = "cohen1988") d2_ <- interpret(d2, rules = "cohen1988") - expect_equal(d1_$Interpretation, d2_$Interpretation) - expect_equal(d1_[[1]], d1[[1]]) - expect_equal(d2_[[1]], d2[[1]]) + expect_identical(d1_$Interpretation, d2_$Interpretation) + expect_identical(d1_[[1]], d1[[1]]) + expect_identical(d2_[[1]], d2[[1]]) })