Skip to content

Commit

Permalink
add matching check
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosemary Li committed Jan 17, 2024
1 parent 2881071 commit 4eb2926
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/calculate_study_day.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ calculate_study_day <- function(sdtm_in,
assertthat::assert_that(hasName(dm_domain, merge_key))
assertthat::assert_that(hasName(sdtm_in, merge_key))
assertthat::assert_that(is.character(study_day_var))
# check tgdt and study_day_var matching, for example, CMSTDTC matches CMSTDY
if (gsub("DTC", "", tgdt) != gsub("DY", "", study_day_var)) {
warning(
"Target date and the returned study day doesn't match. ",
"Expecting matching date and study day, for example, CMENDTC and CMENDY"
)
}

if (!identical(sdtm_in, dm_domain)) {
dm_domain <- unique(dm_domain[c(merge_key, refdt)])
Expand Down

0 comments on commit 4eb2926

Please sign in to comment.