yarrr (version 0.1.5)

apa: apa

Description

This function takes a hypothesis test object (e.g.; t.test(), cor.test(), chisq.test()) as an input, and returns a string with the test result in APA format.

Usage

apa(test.object, tails = 2, sig.digits = 2, p.lb = 0.01)

Arguments

test.object
A hypothesis test object generated by functions such as t.test(), cor.test, chisq.test()
tails
The number of tails in the test (1 or 2)
sig.digits
The number of digits results are rounded to
p.lb
The lower bound of the p-value display. If the p-value is less than p.lb, the exact value will not be displayed.

Examples

Run this code

x <- rnorm(100)
y <- x + rnorm(100)
a <- sample(1:3, size = 200, prob = c(.3, .2, .5), replace = TRUE)
b <- sample(1:3, size = 200, prob = c(.3, .2, .5), replace = TRUE)

apa(t.test(x, y))
apa(cor.test(x, y))
apa(chisq.test(table(a, b)))



Run the code above in your browser using DataCamp Workspace