tests/testthat/test_check_ind.R

context("Test check_ind() function")

test_that("Correct data passes", {
  ind <- data.frame(
    "var" = c("a", "b", "c", "a", "b", "c", "a")
  )
  ind <- model.matrix(~ ind$var - 1)
  expect_silent(check_ind(ind))
})

test_that("Incorrect data fails", {
  ind <- data.frame(
    "var" = c("a", "b", "c", "a", "b", "c", "a")
  )
  ind <- model.matrix(~ ind$var - 1)
  ind[2, 3] <- 1
  expect_error(check_ind(ind))
})

Try the rakeR package in your browser

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

rakeR documentation built on May 2, 2019, 5:13 a.m.