tests/testthat/test_coerce.R

test_that("asInteger works", {
    expect_true(is.integer(asInteger(2.3)))
    expect_error(asInteger("a"))
    myvar <- "2"
    expect_error(asInteger(myvar), "Argument myvar should be")
})

Try the MsCoreUtils package in your browser

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

MsCoreUtils documentation built on Nov. 8, 2020, 10:59 p.m.