R/check_tr_trstresn_ldiam.R
check_tr_trstresn_ldiam.Rd
This checks looks for TR records with missing values in numeric result/finding for the Longest Diameter (TRTESTCD is LDIAM) tumor measurement. Only applies to assessments by investigator, selected based on uppercased TREVAL = "INVESTIGATOR" or missing or TREVAL variable does not exist.
check_tr_trstresn_ldiam(TR, preproc = identity, ...)
Tumor Results SDTM dataset with variables USUBJID, TRTESTCD, TRLINKID/TRLNKID, TRDTC, VISIT, TRORRES, TRSTRESN, TREVAL (optional), TRSTAT (optional), TRSPID (optional)
An optional company specific preprocessing script
Other arguments passed to methods
Boolean value for whether the check passed or failed, with 'msg' attribute if the check failed
TR <- data.frame(USUBJID = 1:5,
TRTESTCD = c("OTHER", rep("LDIAM", 4)),
TRLINKID = 1:5,
TRDTC = 1:5,
VISIT = LETTERS[1:5],
TRORRES = LETTERS[1:5],
TRSTRESN = 1:5,
TRSTAT = "",
TREVAL = "INVESTIGATOR",
TRSPID = "FORMNAME-R:19/L:19XXXX",
stringsAsFactors = FALSE)
check_tr_trstresn_ldiam(TR)
#> [1] TRUE
TR1 <- TR
TR1$TRSTAT <- NULL
TR1$TREVAL <- NULL
TR1$TRSPID <- NULL
check_tr_trstresn_ldiam(TR1)
#> [1] TRUE
TR2 <- TR
TR2$TRSTRESN <- c("", "NA", NA, 1, 1)
check_tr_trstresn_ldiam(TR2)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TR has 2 record(s) with missing TRSTRESN values for LDIAM assessment. 0 record(s) indicate 'NOT DONE'. 0 record(s) indicate 'NOT EVALUABLE'. 2 record(s) indicate done and evaluable but otherwise missing."
#> attr(,"data")
#> USUBJID TRTESTCD TRDTC VISIT TRORRES TRSTRESN TRLINKID TRSTAT
#> 2 2 LDIAM 2 B B NA 2
#> 3 3 LDIAM 3 C C <NA> 3
check_tr_trstresn_ldiam(TR2,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TR has 2 record(s) with missing TRSTRESN values for LDIAM assessment. 0 record(s) indicate 'NOT DONE'. 0 record(s) indicate 'NOT EVALUABLE'. 2 record(s) indicate done and evaluable but otherwise missing."
#> attr(,"data")
#> USUBJID TRTESTCD TRDTC VISIT TRORRES TRSTRESN TRLINKID TRSTAT RAVE
#> 2 2 LDIAM 2 B B NA 2 FORMNAME-R:19
#> 3 3 LDIAM 3 C C <NA> 3 FORMNAME-R:19