Skip to content

Commit 2f8ad9e

Browse files
committed
Format smoothed correlation tables
1 parent 181f4ae commit 2f8ad9e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

R/methods_format.R

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ format.easycormatrix <- function(x,
8686
stars_only = stars_only
8787
)
8888
} else if (type == "pd") {
89-
sig[, nums] <- sapply(sig[, nums],
89+
sig[, nums] <- sapply(
90+
sig[, nums],
9091
insight::format_pd,
9192
stars = stars,
9293
stars_only = stars_only
9394
)
9495
} else if (type == "BF") {
95-
sig[, nums] <- sapply(sig[, nums],
96+
sig[, nums] <- sapply(
97+
sig[, nums],
9698
insight::format_bf,
9799
stars = stars,
98100
stars_only = stars_only
@@ -123,7 +125,7 @@ format.easycormatrix <- function(x,
123125
footer <- ""
124126

125127
# P-adjust
126-
if (isFALSE(attributes(x)$bayesian)) {
128+
if (isFALSE(attributes(x)$bayesian) && ! isTRUE(attributes(x)$smoothed)) {
127129
footer <- paste0(
128130
"\np-value adjustment method: ",
129131
parameters::format_p_adjust(attributes(x)$p_adjust)
@@ -153,10 +155,15 @@ format.easycormatrix <- function(x,
153155
#' @keywords internal
154156
.format_easycorrelation_caption <- function(x, format = NULL) {
155157
if (!is.null(attributes(x)$method)) {
158+
if (isTRUE(attributes(x)$smoothed)) {
159+
prefix <- "Smoothed Correlation Matrix ("
160+
} else {
161+
prefix <- "Correlation Matrix ("
162+
}
156163
if (is.null(format) || format == "text") {
157-
caption <- c(paste0("# Correlation Matrix (", unique(attributes(x)$method), "-method)"), "blue")
164+
caption <- c(paste0("# ", prefix, unique(attributes(x)$method), "-method)"), "blue")
158165
} else {
159-
caption <- paste0("Correlation Matrix (", unique(attributes(x)$method), "-method)")
166+
caption <- paste0(prefix, unique(attributes(x)$method), "-method)")
160167
}
161168
} else {
162169
caption <- NULL

0 commit comments

Comments
 (0)