This check looks for missing RSDTC or VISIT values when RSORRES is not missing and RSSTAT not equal to "NOT DONE" in RS dataset and returns a data frame. Only applies to assessments by investigator.

check_rs_rsdtc_visit(RS)

Arguments

RS

Disease Response SDTM dataset with variables USUBJID, RSDTC, RSORRES, VISIT, RSSTAT

Value

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

Author

Peggy Wen, Stella Banjo (HackR 2021)

Examples


RS <- data.frame(
USUBJID = 1:10,
RSDTC = 1:10,
RSORRES = "THING",
VISIT = "C1D1",
RSSTAT = 1:10,
RSEVAL = c("NA","","IRF","investigator",rep("INVESTIGATOR",6)),
stringsAsFactors=FALSE
)

RS$RSDTC[1]=""
RS$RSDTC[2]="NA"
RS$RSDTC[3]=NA
RS$VISIT[3]=""
RS$VISIT[4]="NA"
RS$VISIT[5]=NA
check_rs_rsdtc_visit(RS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 4 records with missing RSDTC or VISIT. "
#> attr(,"data")
#>   USUBJID RSDTC RSORRES VISIT RSSTAT       RSEVAL
#> 1       1         THING  C1D1      1           NA
#> 2       2    NA   THING  C1D1      2             
#> 3       4     4   THING    NA      4 investigator
#> 4       5     5   THING  <NA>      5 INVESTIGATOR

RS$RSORRES[1]=""
check_rs_rsdtc_visit(RS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 3 records with missing RSDTC or VISIT. "
#> attr(,"data")
#>   USUBJID RSDTC RSORRES VISIT RSSTAT       RSEVAL
#> 1       2    NA   THING  C1D1      2             
#> 2       4     4   THING    NA      4 investigator
#> 3       5     5   THING  <NA>      5 INVESTIGATOR

RS$RSORRES[4] = "THING 1"
RS$RSORRES[5] = "THING 2"

check_rs_rsdtc_visit(RS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 3 records with missing RSDTC or VISIT. "
#> attr(,"data")
#>   USUBJID RSDTC RSORRES VISIT RSSTAT       RSEVAL
#> 1       2    NA   THING  C1D1      2             
#> 2       4     4 THING 1    NA      4 investigator
#> 3       5     5 THING 2  <NA>      5 INVESTIGATOR