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)
  )
})

Try the nima package in your browser

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

nima documentation built on March 13, 2020, 2:10 a.m.