create_BLFL {sdtmval} | R Documentation |
Create a BLFL column
Description
Utilizes the BLFL method from the SDTM spec to create a baseline flag: Equal
to "Y" for last record with non-missing –ORRES on or before first dose date
(RFSTDTC); NA
otherwise.
Usage
create_BLFL(
tbl,
sort_date,
domain,
grouping_vars = "USUBJID",
RFSTDTC = "RFSTDTC",
compare_date_method = "on or before"
)
Arguments
tbl |
a data frame with the variables |
sort_date |
a string, the column name by which to sort records within
each |
domain |
a string, the SDTM domain abbreviation |
grouping_vars |
a character vector of columns to group by when assigning
the BLFL, default is |
RFSTDTC |
a string, the column to use for |
compare_date_method |
a string, one of |
Value
a modified copy of tbl
with the new column [domain]BLFL
See Also
Examples
df <- dplyr::tibble(
USUBJID = c(
rep(1, 3),
rep(2, 3)
),
XXORRES = c(
1, 2, 2,
1, 2, NA
),
XXDTC = as.Date(c(
"2017-02-05", "2017-02-06", "2017-02-07",
"2017-02-05", "2017-02-06", "2017-02-07"
)),
RFSTDTC = as.Date(c(
rep("2017-02-05", 3),
rep("2017-02-07", 3)
))
)
create_BLFL(df, sort_date = "XXDTC", domain = "XX")