Learn R Programming

apa (version 0.3.4)

cor_apa: Report Correlation in APA style

Description

Report Correlation in APA style

Usage

cor_apa(
  x,
  r_ci = FALSE,
  format = c("text", "markdown", "rmarkdown", "html", "latex", "latex_math", "docx",
    "plotmath"),
  info = FALSE,
  print = TRUE
)

Arguments

x

A call to cor.test

r_ci

Logical indicating whether to display the confidence interval for the correlation coefficient (default is FALSE). Only available for Pearson's product moment correlation (with n >= 4).

format

Character string specifying the output format. One of "text", "markdown", "rmarkdown", html, "latex", "latex_math", "docx" or "plotmath".

info

Logical indicating whether to print a message on the used test (default is FALSE)

print

Logical indicating whether to print the formatted output via cat (TRUE, default) or return as character string.

Examples

Run this code
# Example data from ?cor.test
x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y <- c( 2.6,  3.1,  2.5,  5.0,  3.6,  4.0,  5.2,  2.8,  3.8)

cor_apa(cor.test(x, y))

# Spearman's rho
cor_apa(cor.test(x, y, method = "spearman"))

# Kendall's tau
cor_apa(cor.test(x, y, method = "kendall"))

Run the code above in your browser using DataLab