apa

Share:

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

1
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

1
2
3
4
5
6
7
8
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)))