tests/testthat/test-make.dummy.R

d <- data.frame(
  years = 1:5,
  number = rnorm(5),
  level = c("top", "mid", "low", "mid", "top"),
  distance = factor(c("far", "near", "near", "far", "far")),
  sold = c(TRUE, TRUE, FALSE, FALSE, TRUE)
)

test_that("make dummy", {
  dummy_d <- expect_no_error(make_dummy(d))
  expect_setequal(
    names(dummy_d),
    c(
      "years", "number", "level.top", "level.mid",
      "distance.far", "sold"
    )
  )
})

Try the hgwrr package in your browser

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

hgwrr documentation built on April 4, 2025, 3:57 a.m.