Skip to contents

This function searches for variables that appear to be incorrectly listed as TYPE integer.

Usage

integer_check(DD.dict, DS.data, verbose = TRUE)

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 may be incorrectly labeled as TYPE integer.

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 variables that are listed as TYPE integer, but do not appear to be integers).

Examples

# Example 1: Fail check
data(ExampleH)
integer_check(DD.dict.H, DS.data.H)
#> $Message
#> [1] "ERROR: some variables listed as TYPE integer do not appear to be integers."
#> 
#> $Information
#> [1] "SUP_SKF"
#> 
print(integer_check(DD.dict.H, DS.data.H, verbose=FALSE))
#> # A tibble: 1 × 5
#>   Time                Function      Status Message                   Information
#>   <dttm>              <chr>         <chr>  <chr>                     <named lis>
#> 1 2023-09-27 11:01:17 integer_check Failed ERROR: some variables li… <chr [1]>  

# Example 2: Pass check
data(ExampleA)
integer_check(DD.dict.A, DS.data.A)
#> $Message
#> [1] "Passed: all variables listed as TYPE integer appear to be integers."
#> 
print(integer_check(DD.dict.A, DS.data.A, verbose=FALSE))
#> # A tibble: 1 × 5
#>   Time                Function      Status Message                   Information
#>   <dttm>              <chr>         <chr>  <chr>                     <named lis>
#> 1 2023-09-27 11:01:17 integer_check Passed Passed: all variables li… <chr [0]>  

data(ExampleR)
integer_check(DD.dict.R, DS.data.R)
#> $Message
#> [1] "Passed: all variables listed as TYPE integer appear to be integers."
#> 
print(integer_check(DD.dict.R, DS.data.R, verbose=FALSE))
#> # A tibble: 1 × 5
#>   Time                Function      Status Message                   Information
#>   <dttm>              <chr>         <chr>  <chr>                     <named lis>
#> 1 2023-09-27 11:01:17 integer_check Passed Passed: all variables li… <chr [0]>