assert_unit: Asserts That a Parameter is Provided in the Expected Unit

Description Usage Arguments Value Author(s) Examples

View source: R/assertions.R

Description

Checks if a parameter (PARAMCD) in a dataset is provided in the expected unit.

Usage

1
assert_unit(dataset, param, required_unit, get_unit_expr)

Arguments

dataset

A data.frame

param

Parameter code of the parameter to check

required_unit

Expected unit

get_unit_expr

Expression used to provide the unit of param

Value

The function throws an error if the unit variable differs from the unit for any observation of the parameter in the input dataset

Author(s)

Stefan Bundfuss

Examples

1
2
3
4
5
6
data(advs)
assert_unit(advs, param = "WEIGHT", required_unit = "kg", get_unit_expr = VSSTRESU)
## Not run: 
assert_unit(advs, param = "WEIGHT", required_unit = "g", get_unit_expr = VSSTRESU)

## End(Not run)

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.