| check_dm_usubjid_dup {sdtmchecks} | R Documentation | 
Check duplicate patient records in DM based on USUBJID
Description
This check looks for duplicate patient demographics records in DM
Usage
check_dm_usubjid_dup(DM)
Arguments
| DM | Demographics SDTM dataset with variable USUBJID | 
Value
Boolean value for whether the check passed or failed, with 'msg' attribute if the check failed
Author(s)
Madeleine Ma, Stella Banjo (HackR 2021)
Examples
## duplicates and same patient number across sites for 3-part USUBJID
DM <- data.frame(USUBJID = c("GO12345-00000-1000",
                             "GO12345-11111-1000",
                             "GO12345-00000-1000",
                             "GO12345-00000-1001"),
      stringsAsFactors = FALSE)
check_dm_usubjid_dup(DM)
## no duplicate IDs in the dataframe for 3-part USUBJID
DM2 <- data.frame(USUBJID = c("GO12345-00000-1000",
                              "GO12345-11111-1001",
                              "GO12345-11111-1002"),
             stringAsFactors = FALSE)
check_dm_usubjid_dup(DM2)
## duplicates for 2-part USUBJID
DM3 <- data.frame(USUBJID = c("GO12345-1000",
                              "GO12345-1000"),
            stringAsFactors = FALSE)
check_dm_usubjid_dup(DM3)
##  no duplicate IDs in the dataframe for 2-part USUBJID
DM4 <- data.frame(USUBJID = c("GO12345-1000",
                              "GO12345-1001",
                              "GO12345-1002"),
             stringAsFactors = FALSE)
check_dm_usubjid_dup(DM4)
##  dataframe with one or two additional variables, if there is variation across other variables
DM5 <- data.frame(USUBJID = c("GO12345-1000",
                              "GO12345-1000"),
                  SEX = c("M", "F"),
                  AGE = c(18, 60),
         stringAsFactors = FALSE)
check_dm_usubjid_dup(DM5)
## dataframe in which USUBJID is not present
DM6 <- data.frame(
         STUDYID = c("GO12345"),
         SEX = c("M"),
         AGE = c(72),
     stringAsFactors = FALSE)
check_dm_usubjid_dup(DM6)
[Package sdtmchecks version 1.0.0 Index]