tests/testthat/test-goodnessOfFitTest.R

gender <- factor(c( "male","male","male","male","female","female",
                    "female","male","male","male"))

test_that("goodnessOfFitTest example works", {

  expect_s3_class(goodnessOfFitTest(gender), "gofTest")
  expect_warning(goodnessOfFitTest(gender, p=c(.4,.6)), "chi-squared approximation")

  expect_equal(
    goodnessOfFitTest(gender)$p.value,
    chisq.test(table(gender))$p.value
  )

})

Try the lsr package in your browser

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

lsr documentation built on Dec. 11, 2021, 9:10 a.m.