Skip to contents

This function checks that there is a unique description for every variable in the data dictionary (VARDESC column).

Usage

description_check(DD.dict, verbose = TRUE)

Arguments

DD.dict

Data dictionary.

verbose

When TRUE, the function prints the Message out, as well as a list of the variables that are missing a VARDESC or have a duplicated VARDESC.

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 (Names of the variables with missing or duplicated descriptions).

Examples

# Example 1: Fail check 
data(ExampleG)
description_check(DD.dict.G)
#> $Message
#> [1] "ERROR: missing and duplicate descriptions found in data dictionary."
#> 
#> $Information
#> # A tibble: 4 × 2
#>   VARNAME  VARDESC              
#>   <chr>    <chr>                
#> 1 PREGNANT NA                   
#> 2 REACT    NA                   
#> 3 HEIGHT   Height of participant
#> 4 WEIGHT   Height of participant
#> 
print(description_check(DD.dict.G, verbose=FALSE))
#> # A tibble: 1 × 5
#>   Time                Function          Status Message               Information
#>   <dttm>              <chr>             <chr>  <chr>                 <named lis>
#> 1 2023-09-27 11:01:15 description_check Failed ERROR: missing and d… <tibble>   

# Example 2: Pass check
data(ExampleA)
description_check(DD.dict.A)
#> $Message
#> [1] "Passed: unique description present for all variables in the data dictionary."
#> 
print(description_check(DD.dict.A, verbose=FALSE))
#> # A tibble: 1 × 5
#>   Time                Function          Status Message               Information
#>   <dttm>              <chr>             <chr>  <chr>                 <named lis>
#> 1 2023-09-27 11:01:15 description_check Passed Passed: unique descr… <chr [1]>