Check for patients with populated RSSCAT but missing RSCAT in RS domain to help flag a potential mapping issue for SPA; this does not warrant a query in Rave.

check_rs_rscat_rsscat(RS)

Arguments

RS

Response SDTM dataset with variables USUBJID, RSCAT and RSSCAT.

Value

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

Author

Saibah Chohan, Ashley Mao, Tina Cho (HackR 2021 Team STA-R)

Examples


RS <- data.frame(
 USUBJID = c("id1", "id1", "id2", "id2", "id3"),
 RSCAT = c("A", "A", "B", NA, NA),
 RSSCAT = c("AA", "AA", "BB", "BB","AA"))
check_rs_rscat_rsscat(RS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with unpopulated RSCAT values. "
#> attr(,"data")
#>   USUBJID RSCAT RSSCAT
#> 4     id2  <NA>     BB
#> 5     id3  <NA>     AA

# Test with missing RSCAT
RS$RSCAT = NULL
check_rs_rscat_rsscat(RS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "RS is missing the variable: RSCAT"