Skip to contents

This function checks whether any duplicated SUBJECT_ID values are present in the dataset. While duplication may be expected in longitudinal data, it may indicate an error in cross-sectional submissions.

Usage

duplicated_id_check(DS.data, verbose = TRUE)

Arguments

DS.data

Data set.

verbose

When TRUE, the function prints the Message out, as well as more detailed diagnostic information.

Value

Tibble, returned invisibly, containing: (1) Time (Time stamp); (2) Name (Name of the function); (3) Status (Passed/Warning); (4) Message (A copy of the message the function printed out); (5) Information (Details about duplicated SUBJECT_ID values).

Details

Duplicated Subject IDs are allowed in longitudinal data sets. This is an informational check.

See also

Examples

# Example 1: Warning, duplicated 'SUBJECT_ID'
data(ExampleT)
duplicated_id_check(DS.data.T)
#> $Message
#> [1] "WARNING: duplicated SUBJECT_ID values detected; if expected due to longitudinal data, this can be ignored - otherwise, please review."
#> 
#> $Information
#> # A tibble: 2 × 1
#>   Duplicated_SUBJECT_IDs
#>                    <int>
#> 1                      1
#> 2                      2
#> 

# Example 2: Pass check 
data(ExampleA)
duplicated_id_check(DS.data.A)
#> $Message
#> [1] "Passed: no duplicated SUBJECT_ID values found."
#> 
#> $Information
#> # A tibble: 0 × 1
#> # ℹ 1 variable: Duplicated_SUBJECT_IDs <chr>
#>