The derive_var_dthcaus()
function and dthcaus_source()
have been superseded in favor of
derive_vars_extreme_event()
.
Usage
dthcaus_source(
dataset_name,
filter,
date,
order = NULL,
mode = "first",
dthcaus,
set_values_to = NULL
)
Arguments
- dataset_name
The name of the dataset, i.e. a string, used to search for the death cause.
- filter
An expression used for filtering
dataset
.- date
A date or datetime variable or an expression to be used for sorting
dataset
.- order
Sort order
Additional variables/expressions to be used for sorting the
dataset
. The dataset is ordered bydate
andorder
. Can be used to avoid duplicate record warning.Permitted Values: list of expressions created by
exprs()
, e.g.,exprs(ADT, desc(AVAL))
orNULL
- mode
One of
"first"
or"last"
. Either the"first"
or"last"
observation is preserved from thedataset
which is ordered bydate
.- dthcaus
A variable name, an expression, or a string literal
If a variable name is specified, e.g.,
AEDECOD
, it is the variable in the source dataset to be used to assign values toDTHCAUS
; if an expression, e.g.,str_to_upper(AEDECOD)
, it is evaluated in the source dataset and the results is assigned toDTHCAUS
; if a string literal, e.g."Adverse Event"
, it is the fixed value to be assigned toDTHCAUS
.- set_values_to
Variables to be set to trace the source dataset
See also
Other superseded:
date_source()
,
derive_param_extreme_record()
,
derive_var_dthcaus()
,
derive_var_extreme_dt()
,
derive_var_extreme_dtm()
,
get_summary_records()
Examples
# Deaths sourced from AE
src_ae <- dthcaus_source(
dataset_name = "ae",
filter = AEOUT == "FATAL",
date = AEDTHDT,
mode = "first",
dthcaus = AEDECOD
)
# Deaths sourced from DS
src_ds <- dthcaus_source(
dataset_name = "ds",
filter = DSDECOD == "DEATH",
date = convert_dtc_to_dt(DSSTDTC),
mode = "first",
dthcaus = DSTERM
)