test_that("censor works as scales::censor", {
test_int <- c(-1L, 0L, 1L, 2L)
test_num <- c(-0.5, 0.2, 1.1, Inf)
expect_identical(censor(test_int),
scales::censor(test_int))
expect_identical(censor(test_num),
scales::censor(test_num))
})
test_that("squish works as scales::squish", {
test_int <- c(-1L, 0L, 1L, 2L)
test_num <- c(-0.5, 0.2, 1.1, Inf)
expect_identical(squish(test_int),
scales::squish(test_int))
expect_identical(squish(test_num),
scales::squish(test_num))
})
test_that("squish_infinite works as scales::squish_infinite", {
test_int <- c(-1L, 0L, 1L, 2L)
test_num <- c(-0.5, 0.2, 1.1, Inf)
expect_identical(squish_infinite(test_int),
scales::squish_infinite(test_int))
expect_identical(squish_infinite(test_num),
scales::squish_infinite(test_num))
})
test_that("discard_oob works on integers and doubles", {
test_int <- c(-1L, 0L, 1L, 2L)
test_num <- c(-0.5, 0.2, 1.1, Inf)
expect_equal(discard_oob(test_int), c(0, 1))
expect_equal(discard_oob(test_num), 0.2)
expect_null(discard_oob(NULL))
})
test_that("discard_oob takes a range argument", {
test_num <- c(-0.5, 1, 1.5)
expect_equal(discard_oob(test_num, c(-0.5, 1)), c(-0.5, 1))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.