format_stats.easycorrelation {cocoon} | R Documentation |
Format correlation statistics
Description
This functions formats correlation statistics generated from the
{correlation} package.
This detects whether the object is from a Pearson, Spearman, or Kendall
correlation and reports the appropriate correlation label
(r, \tau
, \rho
). The default output is APA formatted, but
numbers of digits, leading zeros, the presence of confidence intervals,
and italics are all customizable.
Usage
## S3 method for class 'easycorrelation'
format_stats(
x,
digits = 2,
pdigits = 3,
pzero = FALSE,
full = TRUE,
italics = TRUE,
type = "md",
...
)
Arguments
x |
An |
digits |
Number of digits after the decimal for means, confidence intervals, and test statistics |
pdigits |
Number of digits after the decimal for p-values, ranging between 1-5 (also controls cutoff for small p-values) |
pzero |
Logical value (default = FALSE) for whether to include leading zero for p-values |
full |
Logical value (default = TRUE) for whether to include means and confidence intervals or just test statistic and p-value |
italics |
Logical value (default = TRUE) for whether p label should be italicized |
type |
Type of formatting ("md" = markdown, "latex" = LaTeX) |
... |
Additional arguments passed to methods. |
Value
A character string of statistical information formatted in Markdown or LaTeX.
See Also
Other functions for printing statistical objects:
format_bf()
,
format_corr()
,
format_stats()
,
format_stats.BFBayesFactor()
,
format_stats.htest()
,
format_ttest()
Examples
# Prepare statistical objects
test_corr <- correlation::correlation(mtcars, select = "mpg", select2 = "disp")
test_corr2 <- correlation::correlation(mtcars, select = "mpg", select2 = "disp", method = "kendall")
# Format correlation
format_stats(test_corr)
# Remove confidence intervals and italics
format_stats(test_corr, full = FALSE, italics = FALSE)
# Change digits and add leading zero to p-value
format_stats(test_corr, digits = 3, pdigits = 4, pzero = TRUE)
# Format Kendall's tau for LaTeX
format_stats(test_corr2, type = "latex")