View source: R/create_deathvar.R
create_deathvar | R Documentation |
Calculates cause-specific death (and optionally time to death) from codes in the Cause of Death Registry.
create_deathvar( cohortdata, indexdate, deathdate, censdate, calctimetodeath = FALSE, name, orsakkod, orsakvar = ULORSAK, valsclass = "num", meta_reg = "Cause of Death", meta_pos, warnings = TRUE )
cohortdata |
Data containing the cohort. |
indexdate |
Index date for the patient (usually date of admission or discharge entered into SwedeHF). Must be given if calctimetodeath = TRUE. |
deathdate |
Vector of death dates. |
censdate |
Vector of dates. Deaths are allowed up until this day (usually date of death or end follow-up). |
calctimetodeath |
Should time to death be calculated? Default is FALSE. |
name |
Name of resulting variable (prefix is sos_out_death). |
orsakkod |
String of icd codes as a regular expression defining the cause specific death. Should preferably start with blank space " ". |
orsakvar |
Column where diakod is found. All codes should preferably start with blank space " ". Default is ULORSAK. |
valsclass |
optional argument specifying the class of the comorbidities/outcomes. Allowed values are "num" (numeric: 1, 0), "char" (character: "Yes", "No"), "fac" (factor: "Yes", "No"). Default is "num". |
meta_reg |
Optional argument specifying registries used. Printed in metadatatable. Default is "Cause of Death". |
meta_pos |
Optional argument specifying positions used to search for deaths. Printed in metadatatable. |
warnings |
Should warnings be printed. Default is FALSE. |
dataset with column containing cause-specifc death. Also dataset metaout that writes directly to global enviroment with information on constructed variables.
prep_sosdata
create_sosvar
dors_data <- prep_sosdata(dors_data, registry = "dors", impute = FALSE) rs_data <- dplyr::left_join(rs_data, dors_data, by = "id") rs_data <- create_deathvar( cohortdata = rs_data, name = "cv", orsakkod = " I" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.