This check looks for missing AEDECOD values

check_ae_aedecod(AE, preproc = identity, ...)

Arguments

AE

Adverse Events SDTM dataset with variables USUBJID, AETERM, AEDECOD

preproc

An optional company specific preprocessing script

...

Other arguments passed to methods

Value

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

Author

Yinghui Miao, Stella Banjo(HackR 2021)

Examples


AE <- data.frame(
 USUBJID = 1:5,
 DOMAIN = c(rep("AE", 5)),
 AESEQ = 1:5,
 AESTDTC = 1:5,
 AETERM = 1:5,
 AEDECOD = 1:5,
  AESPID = c("FORMNAME-R:13/L:13XXXX",
             "FORMNAME-R:16/L:16XXXX",
             "FORMNAME-R:2/L:2XXXX",
             "FORMNAME-R:19/L:19XXXX",
             "FORMNAME-R:5/L:5XXXX"),
 stringsAsFactors = FALSE
)

check_ae_aedecod(AE)
#> [1] TRUE

AE$AEDECOD[1] = NA
AE$AEDECOD[2] = "NA"
AE$AEDECOD[3:5] = ""
check_ae_aedecod(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 5 record(s) with missing AEDECOD. "
#> attr(,"data")
#>   USUBJID AESTDTC AETERM AEDECOD
#> 1       1       1      1    <NA>
#> 2       2       2      2      NA
#> 3       3       3      3        
#> 4       4       4      4        
#> 5       5       5      5        
check_ae_aedecod(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 5 record(s) with missing AEDECOD. "
#> attr(,"data")
#>   USUBJID          RAVE AESTDTC AETERM AEDECOD
#> 1       1 FORMNAME-R:13       1      1    <NA>
#> 2       2 FORMNAME-R:16       2      2      NA
#> 3       3  FORMNAME-R:2       3      3        
#> 4       4 FORMNAME-R:19       4      4        
#> 5       5  FORMNAME-R:5       5      5        

AE$AEDECOD <- NULL
check_ae_aedecod(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variable: AEDECOD"