README.md

CRAN
status Lifecycle:
experimental

Codecov test
coverage R-CMD-check

Overview

This package provides a set of tools for data validation in R. This includes a variety of predicate functions to check properties of an R object with accompanying assertions.

Installation

You can install the development version of pure from GitHub with:

# install.packages("remotes")
remotes::install_github("functr/pure")

Usage

The following example uses pure to assert the input and output values of a function.

library(pure)

Safely divide integers

safe_divide_integers <- function(x, y) {

  assert(is_pure_integer, is_scalar)(x)
  assert(is_pure_integer, is_scalar, is_not_zero)(y)

  assert(is_pure_double)(x / y)

}


armcn/pure documentation built on Dec. 30, 2021, 12:16 a.m.