Learn R Programming

sdtmchecks (version 1.0.0)

check_ex_dup: Check for duplicate EX records

Description

This check looks for duplicate treatment records in EX

Usage

check_ex_dup(EX)

Value

boolean value if check failed or passed with 'msg' attribute if the test failed

Arguments

EX

Exposure SDTM dataset with variables USUBJID, EXTRT, EXDOSE, EXSTDTC, EXSTDTC. VISIT is optional.

Author

Fang Yuan

Examples

Run this code

EX <- data.frame(
 USUBJID = rep(1,2),
 EXTRT = rep(1,2),
 EXDOSE = rep(1,2),
 EXSTDTC = rep(1,2),
 EXOCCUR = "Y"
)
check_ex_dup(EX)

EX$EXOCCUR <- NULL

check_ex_dup(EX)

EX$EXDOSE <- NULL

check_ex_dup(EX)

# test with sample data without duplicates

EX <- data.frame(
USUBJID = 1:2,
EXTRT = 1:2,
EXDOSE = 1:2,
EXSTDTC = 1:2,
EXOCCUR = "Y"
)

check_ex_dup(EX)

EX = rbind(EX,EX)

check_ex_dup(EX)

# check non existing vars

EX$EXTRT <- NULL
EX$EXOCCUR <- NULL

check_ex_dup(EX)


Run the code above in your browser using DataLab