Skip to contents

Checks if a parameter (PARAMCD) does not exist in a dataset.

Usage

assert_param_does_not_exist(dataset, param)

Arguments

dataset

A data.frame

param

Parameter code to check

Value

The function throws an error if the parameter exists in the input dataset. Otherwise, the dataset is returned invisibly.

Examples

library(tibble)
advs <- tribble(
  ~USUBJID, ~VSTESTCD, ~VSTRESN, ~VSSTRESU, ~PARAMCD, ~AVAL,
  "P01",    "WEIGHT",      80.1, "kg",      "WEIGHT",  80.1,
  "P02",    "WEIGHT",      85.7, "kg",      "WEIGHT",  85.7
)
assert_param_does_not_exist(advs, param = "HR")
try(assert_param_does_not_exist(advs, param = "WEIGHT"))
#> Error in assert_param_does_not_exist(advs, param = "WEIGHT") : 
#>   The parameter code 'WEIGHT' does already exist in `advs`.