tests/testthat/test-unf6-factor.R

context("UNFv6: Factors")

test_that("Factors treated as character", {
    expect_equal(unf6(c('1','2','3')), 
                 unf6(factor(c('1','2','3')), factor_as_character = TRUE))
})

test_that("Factors can be treated as integer", {
    expect_equal(unf6(1:3), 
                 unf6(factor(c('a','b','c')), factor_as_character = FALSE))
    expect_equal(unf6(1:3), 
                 unf6(factor(c('1','2','3')), factor_as_character = FALSE))
})

Try the UNF package in your browser

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

UNF documentation built on April 13, 2022, 5:06 p.m.