From 4e942aedc5ffca8d934b6416728f1f1f178eeba6 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Thu, 27 Jun 2024 08:23:08 +0300 Subject: [PATCH] deal with https://github.com/easystats/report/issues/442 --- R/interpret.R | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/R/interpret.R b/R/interpret.R index 993566aa..ca659ba7 100644 --- a/R/interpret.R +++ b/R/interpret.R @@ -141,8 +141,13 @@ interpret <- function(x, ...) { #' @export interpret.numeric <- function(x, rules, name = attr(rules, "rule_name"), transform = NULL, ...) { - if (is.null(transform)) transform <- identity - transform <- match.fun(transform) + # This is meant to circumvent https://github.com/easystats/report/issues/442 + if (is.character(transform)) { + transform <- match.fun(transform) + } else if (!is.function(transform)) { + transform <- identity + } + x_tran <- transform(x) if (!inherits(rules, "rules")) { @@ -170,8 +175,12 @@ interpret.numeric <- function(x, rules, name = attr(rules, "rule_name"), interpret.effectsize_table <- function(x, rules, transform = NULL, ...) { if (missing(rules)) insight::format_error("You {.b must} specify the rules of interpretation!") - if (is.null(transform)) transform <- identity - transform <- match.fun(transform) + # This is meant to circumvent https://github.com/easystats/report/issues/442 + if (is.character(transform)) { + transform <- match.fun(transform) + } else if (!is.function(transform)) { + transform <- identity + } es_name <- colnames(x)[is_effectsize_name(colnames(x))] value <- transform(x[[es_name]])