test_that("explain_ccsr handles NA & NULL", {
CCSR_PR <- c("URN001", NA, "CAR004")
expect_true(is.na(explain_ccsr(NA)))
expect_false(is.na(explain_ccsr("CAR004")))
expect_equal(explain_ccsr(CCSR_PR)[3], "Percutaneous coronary interventions (PCI)")
expect_equal(explain_ccsr(CCSR_PR)[2], as.character(NA))
bad_category <- c("URN001", "BAD CATEGORY", "CAR004")
explain_ccsr("Bad category") %>%
expect_equal(as.character(NA))
expect_equal(explain_ccsr(bad_category)[2], as.character(NA))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.