tests/testthat/test-factor_to_num.R

context("factornum turns factors with numeric levels to numerics as expected")

test_that("factornum turns a factor with numeric levels into numeric vector", {
  expect_equal(
    factor_to_num(factor(c(3, 4, 9, 4, 9), levels = c(3, 4, 9))),
    c(3, 4, 9, 4, 9)
  )
})
nhejazi/nima documentation built on March 10, 2020, 1:10 a.m.