test_column_between: Test a column is within an expected range

Description Usage Arguments Details Value Examples

View source: R/col-tests.R

Description

Performs a test that no value in a specified column is greater or smaller than an expected minimum and maximum value.

Usage

1
test_column_between(df, col, min_expected, max_expected)

Arguments

df

A dataframe

col

The unquoted column name of the column you want to test

min_expected

The expected minimum value

max_expected

The expected maximum value

Details

This function is also good for verifying that rescaling operations have worked as expected.

Value

The dataframe passed to the function.

Examples

1
2
3
4
5
6
7
8
# Basic usage
test_column_between(mtcars, disp, 50, 500)

# Test a scaling operation
library(dplyr)
mtcars %>%
mutate(disp_scaled = (disp - min(disp)) / (max(disp) - min(disp))) %>%
test_column_between(disp_scaled, 0, 1)

joshmuncke/easytest documentation built on Aug. 14, 2019, 3:07 p.m.