tests/testthat/test-to_dummy.R

context("sjmisc, to_dummy")

library(sjmisc)

x <- to_dummy(data.frame(x = c("yes", "no", "yes", "maybe"), stringsAsFactors = FALSE), suffix = "label")
y <- to_dummy(data.frame(x = c("yes", "no", "yes", "maybe"), stringsAsFactors = TRUE), suffix = "label")

test_that("to_dummy", {
  expect_identical(x, y)
})

Try the sjmisc package in your browser

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

sjmisc documentation built on Dec. 11, 2021, 9:34 a.m.