tests/testthat/test_coalf.R

test_that("works as expected", {

  x = data.frame( c3 = factor( c( 'A', NA, 'C' ) ), c4 = factor( c( 'B', 'B', 'B' ) ), stringsAsFactors = TRUE )
  
  expect_equal(
    as.character( coalf( x$c3, x$c4 ) ),
    c( 'A', 'B', 'C' )
  )

})
  

Try the easyr package in your browser

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

easyr documentation built on March 31, 2023, 6:22 p.m.