context("test-mode")
x <- c(NA, NA, NA, 1L, 2L, 2L)
test_that("Mode works in default setting with na.rm = FALSE", {
expect_equal(Mode(x), NA_integer_)
})
test_that("Mode works with na.rm = TRUE", {
expect_equal(Mode(x, na.rm=TRUE), 2L)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.