tests/testthat/test-aovTable.R

context("aovTable")

test_that("aovTable", {

  set.seed(1)

  # create dataframe
  dat <- createDF(nVP = 50, nTrl = 1,
                  design = list("Comp" = c("comp", "neutral", "incomp")))

  dat <- addDataDF(dat,
                   RT = list("Comp comp"    = c(500, 150, 150),
                             "Comp neutral" = c(550, 150, 150),
                             "Comp incomp"  = c(600, 150, 150)))

  # base R aov
  aovRT <- aov(RT ~ Comp + Error(VP/(Comp)), dat)
  testthat::expect_error(aovTable(aovRT, sphericityCorrections = FALSE), NA)

  # ezANOVA
  aovRT <- ez::ezANOVA(dat, dv = .(RT), wid = .(VP), within = .(Comp),
                       return_aov = TRUE, detailed = TRUE)

  testthat::expect_error(aovTable(aovRT), NA)
  testthat::expect_error(aovTable(aovRT, sphericityCorrections = FALSE), NA)
  testthat::expect_error(aovTable(aovRT, sphericityCorrectionType = "HF"), NA)
  testthat::expect_error(aovTable(aovRT, removeSumSquares = FALSE), NA)

  aovRT <- aovTable(aovRT)
  testthat::expect_error(aovTable(aovRT))

  aovRT <- ez::ezANOVA(dat, dv = .(RT), wid = .(VP), within = .(Comp),
                       return_aov = TRUE, detailed = FALSE)
  testthat::expect_error(aovTable(aovRT))

  aovRT <- ez::ezANOVA(dat, dv = .(RT), wid = .(VP), within = .(Comp),
                       return_aov = FALSE, detailed = TRUE)
  testthat::expect_error(aovTable(aovRT))

})

Try the psychReport package in your browser

Any scripts or data that you put into this service are public.

psychReport documentation built on Sept. 9, 2022, 5:08 p.m.