R/check_ce_missing_month.R
check_ce_missing_month.Rd
Check for missing month when clinical events dates (CESTDTC, CEENDTC, CEDTC) have a known year and day
check_ce_missing_month(CE, preproc = identity, ...)
boolean value if check failed or passed with 'msg' attribute if the test failed
CE <- data.frame(
USUBJID = c(1, 2, 3, 4),
CETERM = c("Headache", "Nausea", "Dizziness", "Fever"),
CESTDTC = c("2023---01", "2023-01-15", "2023-02-01", "2023-02-10"),
CEENDTC = c("2023-01-02", "2023---01", "2023-02-02", "2023-02-12"),
CEDTC = c("2023--01", "", "", ""),
CESEV = c("Mild", "Moderate", "Mild", "Severe"),
CESPID = "FORMNAME-R:13/L:13XXXX",
stringsAsFactors=FALSE
)
check_ce_missing_month(CE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a clinical events date that has year and day present but missing month. "
#> attr(,"data")
#> USUBJID CETERM CESTDTC CEENDTC CEDTC
#> 1 1 Headache 2023---01 2023-01-02 2023--01
#> 2 2 Nausea 2023-01-15 2023---01
check_ce_missing_month(CE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a clinical events date that has year and day present but missing month. "
#> attr(,"data")
#> USUBJID CETERM CESTDTC CEENDTC CEDTC RAVE
#> 1 1 Headache 2023---01 2023-01-02 2023--01 FORMNAME-R:13
#> 2 2 Nausea 2023-01-15 2023---01 FORMNAME-R:13
CE <- data.frame(
USUBJID = c(1, 2, 3, 4),
CETERM = c("Headache", "Nausea", "Dizziness", "Fever"),
CESTDTC = c("2023-01-01", "2023-01-15", "2023-02-01", "2023-02-10"),
CEENDTC = c("2023-01-02", "2023-01-16", "2023-02-02", "2023-02-12"),
CEENDTC = "",
CESEV = c("Mild", "Moderate", "Mild", "Severe"),
CESPID = "FORMNAME-R:13/L:13XXXX",
stringsAsFactors=FALSE
)
check_ce_missing_month(CE)
#> [1] TRUE
CE$CETERM = NULL
check_ce_missing_month(CE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "CE is missing the variable: CETERM"