| expect_all_equal | R Documentation |
These expectations are similar to expect_true(all(x == "x")),
expect_true(all(x)) and expect_true(all(!x)) but give more informative
failure messages if the expectations are not met.
expect_all_equal(object, expected)
expect_all_true(object)
expect_all_false(object)
object, expected |
Computation and value to compare it to. Both arguments supports limited unquoting to make it easier to generate readable failures within a function or for loop. See quasi_label for more details. |
x1 <- c(1, 1, 1, 1, 1, 1)
expect_all_equal(x1, 1)
x2 <- c(1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2)
show_failure(expect_all_equal(x2, 1))
# expect_all_true() and expect_all_false() are helpers for common cases
set.seed(1016)
show_failure(expect_all_true(rpois(100, 10) < 20))
show_failure(expect_all_false(rpois(100, 10) > 20))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.