tests/testthat/test-util.R

test_that("labels_interesting work", {
  expect_equal(labels_interesting(y ~ 1, y ~ 0), c("(Intercept)"))
  expect_equal(labels_interesting(y ~ 0, y ~ 1), character(0))
  expect_equal(labels_interesting(y ~ 0, y ~ 1), character(0))
  expect_equal(labels_interesting(y ~ a, y ~ 1), c("a"))
  expect_equal(labels_interesting(y ~ a, y ~ -1), c("(Intercept)", "a"))
  expect_equal(labels_interesting(y ~ 1, y ~ a), character(0))
  expect_equal(labels_interesting(y ~ a, y ~ a), character(0))
  expect_equal(labels_interesting(y ~ a, y ~ a + b), character(0))
  expect_equal(labels_interesting(y ~ a + c, y ~ a + b), c("c"))
  expect_equal(labels_interesting(y ~ a + b, y ~ c), c("a", "b"))
  expect_equal(labels_interesting(y ~ a:b, y ~ c), c("a:b"))
  expect_equal(labels_interesting(y ~ a + b, y ~ a*b), character(0))
  expect_equal(labels_interesting(y ~ a:b, y ~ b), c("a:b"))
  expect_equal(labels_interesting(y ~ a*b, y ~ b), c("a", "a:b"))
  expect_equal(labels_interesting(y ~ b*a, y ~ b), c("a", "b:a"))
  expect_equal(labels_interesting(y ~ b*a - 1, y ~ b), c("a", "b:a"))
  expect_equal(labels_interesting(y ~ b*a, y ~ b - 1), c("(Intercept)", "a", "b:a"))
  expect_equal(labels_interesting(Y ~ V + R + S + T + V:S + V:T, Y ~ R + S + T + V:S + V:T), c("V"))
})

Try the GET package in your browser

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

GET documentation built on Sept. 11, 2024, 5:46 p.m.