tests/testthat/test.apa.confint.r

context("apa.confint")
library(apaformat)

x = apaformat::testdata.apa.regression.lm
model = lm(Response ~ Treatment, data = x)

ci = confint(model)
tab = apa.confint(ci)
expect_equal(dim(tab)[1], 2)
expect_equal(dim(tab)[2], 1)
expect_equal(tab[1], "[-0.4, 0.4]")
expect_equal(tab[2], "[1.55, 2.68]")
expect_equal(colnames(tab), c("CI 95%"))

ci = confint(model, level = .999)
tab = apa.confint(ci)
expect_equal(dim(tab)[1], 2)
expect_equal(dim(tab)[2], 1)
expect_equal(tab[1], "[-0.71, 0.7]")
expect_equal(tab[2], "[1.12, 3.11]")
expect_equal(colnames(tab), c("CI 99.9%"))
markanewman/apaformat documentation built on May 10, 2019, 1:19 a.m.