Identifies duplicated AE entries based on USUBJID, AETERM, AEDECOD, AESTDTC, AEENDTC, AEMODIFY (if present), AELAT (if present) and AETOXGR or AESEV
check_ae_dup(AE)
boolean value if check failed or passed with 'msg' attribute if the test failed
AE <- data.frame(USUBJID = c(1), AESTDTC = c("2020-01-01","2020-01-01","2020-02-01","2020-03-01"),
AEENDTC = rep("2020-02-01",4), AEDECOD = letters[c(1,1:3)],
AETERM = letters[c(1,1:3)], AETOXGR = c(1,1:3),
AESPID="FORMNAME-R:5/L:5XXXX",
stringsAsFactors=FALSE)
check_ae_dup(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has duplicated entries. "
#> attr(,"data")
#> # A tibble: 2 × 6
#> # Groups: USUBJID, AETERM, AEDECOD, AESTDTC, AEENDTC, AETOXGR [1]
#> USUBJID AETERM AEDECOD AESTDTC AEENDTC AETOXGR
#> <dbl> <chr> <chr> <chr> <chr> <dbl>
#> 1 1 a a 2020-01-01 2020-02-01 1
#> 2 1 a a 2020-01-01 2020-02-01 1