Skip to content

Commit

Permalink
print methods
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 16, 2024
1 parent 5b45fe1 commit ca77ee8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
21 changes: 16 additions & 5 deletions R/print_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,22 @@ print_html.p_rope <- function(x, digits = 2, ...) {

#' @export
print_html.p_significance <- function(x, digits = 2, ...) {
caption <- sprintf(
"Practical Significance (threshold: %s)",
insight::format_value(attributes(x)$threshold, digits = digits)
)
.print_html_default(x = x, digits = digits, caption = caption, ...)
threshold <- attributes(x)$threshold
if (is.list(threshold)) {
caption <- "Practical Significance"
out <- as.data.frame(do.call(rbind, threshold))
colnames(out) <- c("ROPE_low", "ROPE_high")
x$ROPE_low <- out$ROPE_low
x$ROPE_high <- out$ROPE_high
ci_string <- "ROPE"
} else {
caption <- sprintf(
"Practical Significance (threshold: %s)",
insight::format_value(attributes(x)$threshold, digits = digits)
)
ci_string <- NULL
}
.print_html_default(x = x, digits = digits, caption = caption, ci_string = ci_string, ...)
}


Expand Down
21 changes: 16 additions & 5 deletions R/print_md.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,22 @@ print_md.p_rope <- function(x, digits = 2, ...) {

#' @export
print_md.p_significance <- function(x, digits = 2, ...) {
caption <- sprintf(
"Practical Significance (threshold: %s)",
insight::format_value(attributes(x)$threshold, digits = digits)
)
.print_md_default(x = x, digits = digits, caption = caption, ...)
threshold <- attributes(x)$threshold
if (is.list(threshold)) {
caption <- "Practical Significance"
out <- as.data.frame(do.call(rbind, threshold))
colnames(out) <- c("ROPE_low", "ROPE_high")
x$ROPE_low <- out$ROPE_low
x$ROPE_high <- out$ROPE_high
ci_string <- "ROPE"
} else {
caption <- sprintf(
"Practical Significance (threshold: %s)",
insight::format_value(attributes(x)$threshold, digits = digits)
)
ci_string <- NULL
}
.print_md_default(x = x, digits = digits, caption = caption, ci_string = ci_string, ...)
}


Expand Down

0 comments on commit ca77ee8

Please sign in to comment.