View source: R/datasummary_correlation.R
datasummary_correlation_format | R Documentation |
Mostly for internal use, but can be useful when users supply a function to
the method
argument of datasummary_correlation
.
datasummary_correlation_format(
x,
fmt,
leading_zero = FALSE,
diagonal = NULL,
upper_triangle = NULL,
stars = FALSE
)
x |
square numeric matrix |
fmt |
how to format numeric values: integer, user-supplied function, or
|
leading_zero |
boolean. If |
diagonal |
character or NULL. If character, all elements of the diagonal are replaced by the same character (e.g., "1"). |
upper_triangle |
character or NULL. If character, all elements of the upper triangle are replaced by the same character (e.g., "" or "."). |
stars |
to indicate statistical significance
|
library(modelsummary)
dat <- mtcars[, c("mpg", "hp", "disp")]
cor_fun <- function(x) {
out <- cor(x, method = "kendall")
datasummary_correlation_format(
out,
fmt = 2,
upper_triangle = "x",
diagonal = ".")
}
datasummary_correlation(dat, method = cor_fun)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.