test_column_mean: Test the mean value of a column

Description Usage Arguments Value Examples

View source: R/col-tests.R

Description

Performs a test that a specific column has an expected mean value. Optionally - an acceptable tolerance can be specified in standard deviations.

Usage

1
test_column_mean(df, col, mean_expected, sd_tolerance = 0)

Arguments

df

A dataframe

col

The unquoted column name of the column you want to test

mean_expected

The expected mean value

sd_tolerance

The maximum number of standard deviations (+/-) tolerance

Value

The dataframe passed to the function.

Examples

1
2
3
4
5
6
7
# Basic usage
test_column_mean(mtcars, qsec, 17.84875)

# Usage without a stdev tolerance means match must be exactly equal
# Often including a small tolerance is good to allow for rounding errors
mtcars %>%
test_column_mean(mpg, 20.09062, 0.01)

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