Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mattansb committed Jun 27, 2024
1 parent 0423f07 commit 4e942ae
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions R/interpret.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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]])
Expand Down

0 comments on commit 4e942ae

Please sign in to comment.