This function checks for empty or duplicate rows in the data set and data dictionary.
Arguments
- DD.dict
Data dictionary.
- DS.data
Data set.
- verbose
When TRUE, the function prints the Message out, as well as the row numbers of any problematic rows.
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 problematic row and participant ID numbers).
Examples
# Example 1: Fail check
data(ExampleK)
row_check(DD.dict.K, DS.data.K)
#> $Message
#> [1] "ERROR: duplicate and/or blank rows detected in the data set and/or data dictionary."
#>
#> $Information
#> $Information$Empty_DataSet_RowNumbers
#> [1] "102"
#>
#> $Information$Duplicate_DataSet_RowNumbers
#> [1] "7" "19"
#>
#> $Information$Duplicated_SubjectIDs
#> [1] 6 17
#>
#> $Information$Empty_DataDictionary_RowNumbers
#> character(0)
#>
#> $Information$Duplicated_DataDictionary_RowNumbers
#> character(0)
#>
#>
print(row_check(DD.dict.K, DS.data.K, verbose=FALSE))
#> # A tibble: 1 × 5
#> Time Function Status Message Information
#> <dttm> <chr> <chr> <chr> <named list>
#> 1 2023-09-27 11:01:20 row_check Failed ERROR: duplicate and/or bla… <named list>
# Example 2: Pass check
data(ExampleC)
row_check(DD.dict.C, DS.data.C)
#> $Message
#> [1] "Passed: no blank or duplicate rows detected in data set or data dictionary."
#>
print(row_check(DD.dict.C, DS.data.C, verbose=FALSE))
#> # A tibble: 1 × 5
#> Time Function Status Message Information
#> <dttm> <chr> <chr> <chr> <named list>
#> 1 2023-09-27 11:01:20 row_check Passed Passed: no blank or duplica… <named list>