chaining_functions {assertr}R Documentation

Chaining functions

Description

These functions are for starting and ending a sequence of assertr assertions and overriding the default behavior of assertr halting execution on the first error.

Usage

chain_start(data, store_success = FALSE)

chain_end(data, success_fun = success_continue, error_fun = error_report)

Arguments

data

A data frame

store_success

If TRUE each successful assertion is stored in chain.

success_fun

Function to call if assertion passes. Defaults to returning data.

error_fun

Function to call if assertion fails. Defaults to printing a summary of all errors.

Details

For more information, read the relevant section in this package's vignette using, vignette("assertr")

For examples of possible choices for the success_fun and error_fun parameters, run help("success_and_error_functions")

Examples

library(magrittr)

mtcars %>%
  chain_start() %>%
  verify(nrow(mtcars) > 10) %>%
  verify(mpg > 0) %>%
  insist(within_n_sds(4), mpg) %>%
  assert(in_set(0,1), am, vs) %>%
  chain_end()

[Package assertr version 3.0.1 Index]