Skip to contents

Format correlation test results in APA style

Usage

# S3 method for class 'r'
apa(obj, ...)

Arguments

obj

An object from stats::cor.test

...

Other arguments passed to format_results

Value

A string with correlation coefficient, degrees of freedom, and p-value

Examples

# Pearson correlation
x <- rnorm(40)
y <- x * 0.6 + rnorm(40, 0, 0.8)
rc <- cor.test(x, y)
apa(rc)
#> [1] "_r_(38) = 0.56, _p_ < .001"