Learn R Programming

sdtmchecks (version 1.0.0)

check_ex_exstdtc_after_exendtc: Check that all exposure start dates are on or before exposure end dates

Description

This check identifies EXSTDTC values that are after EXENDTC values

Usage

check_ex_exstdtc_after_exendtc(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,EXSTDTC,EXENDTC

Author

Sara Bodach

Examples

Run this code

EX <- data.frame(
 STUDYID = 1,
 USUBJID = 1:12,
 EXTRT = "SOME DRUG",
 EXSTDTC = c("2017-01-01","2017-01-03","2017-01-01T14:26","2017","2017-02","2017"      ,""    ,
             "2017"   ,"2017-01-01T14:26","2017-01-01T14:26","2017-01-01T14","2017-01-01T14:26:02")
             ,
 EXENDTC = c("2017-01-01","2017-01-02","2017-01-01T14:25","2015","2017-01","2016-01-01","2000",
             "2017-02","2017-01-01"      ,"2017-01","2017-01-01T13","2017-01-01T14:26:01")
             ,
 EXOCCUR = "Y",
 VISIT = "CYCLE 1 DAY 1",
 stringsAsFactors=FALSE
)

check_ex_exstdtc_after_exendtc(EX)

EX$EXOCCUR <- NULL
EX$VISIT <- NULL
check_ex_exstdtc_after_exendtc(EX)

EX$EXTRT <- NULL
check_ex_exstdtc_after_exendtc(EX)

Run the code above in your browser using DataLab