This function uses the correlation::correlation()
to generate the correlation table.
cor_test(
data,
cols,
...,
digits = 3,
show_p = FALSE,
method = "pearson",
p_adjust = "none",
streamline = FALSE,
verbose = TRUE,
return_result = FALSE
)
data frame
correlation items. Support dplyr::select()
syntax.
additional arguments passed to correlation::correlation(). See ?correlation::correlation. Note that the return data.frame from correlation::correlation() must contains r
and p
(e.g., passing baysesian = TRUE
will not work)
number of digits to round to
Default is FALSE
. If TRUE
, show the p-value in parenthesis.
Default is "pearson". Options are "kendall", "spearman","biserial", "polychoric", "tetrachoric", "biweight", "distance", "percentage", "blomqvist", "hoeffding", "gamma", "gaussian","shepherd", or "auto". See ?correlation::correlation for detail
Default is "holm". Options are "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "somers" or "none". See ?stats::p.adjust for more detail
print streamlined output.
deafult is TRUE
.
If it is set to TRUE
, it will return the data frame of the correlation table
a data.frame
of the correlation table
cor_test(iris, where(is.numeric))
#> Model Summary
#> Model Type = Correlation
#> Model Method = pearson
#> Adjustment Method = none
#>
#> ───────────────────────────────────────────────────────
#> Var Sepal.Length Sepal.Width Petal.Length
#> ───────────────────────────────────────────────────────
#> Sepal.Length
#> Sepal.Width -0.118
#> Petal.Length 0.872 *** -0.428 ***
#> Petal.Width 0.818 *** -0.366 *** 0.963 ***
#> ───────────────────────────────────────────────────────
#> Note: * p < 0.05, ** p < 0.01, *** p < 0.001