apply_cut | R Documentation |
Removes any records where the datacut flagging variable, usually called DCUT_TEMP_REMOVE, is marked as "Y". Also, sets the death related variables in DM (DTHDTC and DTHFL) to missing if the death after datacut flagging variable, usually called DCUT_TEMP_DTHCHANGE, is marked as "Y".
apply_cut(dsin, dcutvar, dthchangevar)
dsin |
Name of input dataframe |
dcutvar |
Name of datacut flagging variable created by |
dthchangevar |
Name of death after datacut flagging variable created by |
Returns the input dataframe, excluding any rows in which dcutvar
is flagged as "Y".
DTHDTC and DTHFL are set to missing for any records where dthchangevar
is flagged as "Y". Any
variables with the "DCUT_TEMP" prefix are removed.
ae <- data.frame(
USUBJID = c("UXYZ123a", "UXYZ123b", "UXYZ123c", "UXYZ123d"),
DCUT_TEMP_REMOVE = c("Y", "", "NA", NA)
)
ae_final <- apply_cut(dsin = ae, dcutvar = DCUT_TEMP_REMOVE, dthchangevar = DCUT_TEMP_DTHCHANGE)
dm <- data.frame(
USUBJID = c("UXYZ123a", "UXYZ123b", "UXYZ123b"),
DTHDTC = c("2014-10-20", "2014-10-21", "2013-09-08"),
DTHFL = c("Y", "Y", "Y"),
DCUT_TEMP_REMOVE = c(NA, NA, "Y"),
DCUT_TEMP_DTHCHANGE = c(NA, "Y", "")
)
dm_final <- apply_cut(dsin = dm, dcutvar = DCUT_TEMP_REMOVE, dthchangevar = DCUT_TEMP_DTHCHANGE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.