R/check_ss_ssstat_ssorres.R
check_ss_ssstat_ssorres.Rd
This check is for studies with LTFU mapped to the SS domain, check that if 'NOT DONE' (Unable to Contact), then there should not be a response (SSORRES)
check_ss_ssstat_ssorres(SS, preproc = identity, ...)
boolean value if check failed or passed with 'msg' attribute if the test failed
SS <- data.frame(
STUDYID = 1,
USUBJID = c(rep(1,6),rep(2,6)),
SSSTRESC = c("ALIVE", "DEAD", "ALIVE", "", "", "U"),
SSORRES = c("ALIVE", "DEAD", "ALIVE", "", "", "U"),
VISIT = rep(c("SURVIVAL FOLLOW UP 3 MONTHS"),6),
SSSTAT = rep(c("","NOT DONE"),6),
SSDTC = "2016-01-01",
SSSPID = "",
stringsAsFactors = FALSE
)
check_ss_ssstat_ssorres(SS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "SS (LTFU) has 4 record(s) for 2 unique patient(s) with non-missing SSORRES when SSSTAT=NOT DONE (no contact). "
#> attr(,"data")
#> USUBJID VISIT SSDTC SSORRES SSSTAT
#> 1 1 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 DEAD NOT DONE
#> 2 1 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 U NOT DONE
#> 3 2 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 DEAD NOT DONE
#> 4 2 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 U NOT DONE
SS$SSORRES[2]=NA
check_ss_ssstat_ssorres(SS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "SS (LTFU) has 3 record(s) for 2 unique patient(s) with non-missing SSORRES when SSSTAT=NOT DONE (no contact). "
#> attr(,"data")
#> USUBJID VISIT SSDTC SSORRES SSSTAT
#> 1 1 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 U NOT DONE
#> 2 2 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 DEAD NOT DONE
#> 3 2 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 U NOT DONE
SS$SSSPID="FORMNAME-R:5/L:5XXXX"
check_ss_ssstat_ssorres(SS,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "SS (LTFU) has 3 record(s) for 2 unique patient(s) with non-missing SSORRES when SSSTAT=NOT DONE (no contact). "
#> attr(,"data")
#> USUBJID VISIT SSDTC SSORRES SSSTAT RAVE
#> 1 1 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 U NOT DONE FORMNAME-R:5
#> 2 2 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 DEAD NOT DONE FORMNAME-R:5
#> 3 2 SURVIVAL FOLLOW UP 3 MONTHS 2016-01-01 U NOT DONE FORMNAME-R:5
SS$SSORRES[6]=NA
SS$SSORRES[8]=""
SS$SSORRES[12]=NA
check_ss_ssstat_ssorres(SS)
#> [1] TRUE
SS$SSORRES=NULL
check_ss_ssstat_ssorres(SS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "SS is missing the variable: SSORRES"