Description Usage Arguments Examples

Custom failure messages for assertions.

1 2 3 | ```
on_failure(x)
on_failure(x) <- value
``` |

`x` |
a assertion function that returns |

`value` |
a function with parameters |

1 2 3 4 5 6 7 8 9 10 | ```
is_odd <- function(x) {
assert_that(is.numeric(x), length(x) == 1)
x %% 2 == 1
}
see_if(is_odd(2))
on_failure(is_odd) <- function(call, env) {
paste0(deparse(call$x), " is even")
}
see_if(is_odd(2))
``` |

assertthat documentation built on May 29, 2017, 8:41 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.