Skip to contents

This function flags variables that have non-encoded missing value codes.

Usage

missing_value_check(
  DD.dict,
  DS.data,
  verbose = TRUE,
  non.NA.missing.codes = NA
)

Arguments

DD.dict

Data dictionary.

DS.data

Data set.

verbose

When TRUE, the function prints the Message out, as well as a list of variables that have non-encoded missing values.

non.NA.missing.codes

A user-defined vector of numerical missing value codes (e.g., -9999).

Value

Tibble, returned invisibly, containing: (1) Time (Time stamp); (2) Name (Name of the function); (3) Status (Passed/Failed); (4) Message (A copy of the message the function printed out); (5) Information (A list of variables where a missing value code is not properly encoded).

Examples

data(ExampleB)
missing_value_check(DD.dict.B, DS.data.B, non.NA.missing.codes = c(-9999,-4444))
#> $Message
#> [1] "ERROR: some variables have non-encoded missing value codes."
#> 
#> $Information
#>     VARNAME VALUE MEANING  PASS
#> 13 CUFFSIZE -9999    <NA> FALSE
#> 

data(ExampleS)
missing_value_check(DD.dict.S, DS.data.S, non.NA.missing.codes = c(-9999,-4444))
#> $Message
#> [1] "ERROR: some variables have non-encoded missing value codes."
#> 
#> $Information
#>   VARNAME VALUE MEANING  PASS
#> 3 OBESITY  <NA>    <NA> FALSE
#>