Creates a flag variable based on supplied ICD codes.
Usage
construct_cause_flag(dataset, code_pattern, column_pattern, new_column_name)
Arguments
- dataset
The name of the dataframe being used.
- code_pattern
The code, or codes, you are searching for.
- column_pattern
The name, or partial name, of the column(s) being searched.
- new_column_name
The name the column will be called.
Value
A new column containing a 1 or 0 to flag the record.
Examples
data <- data %>% construct_cause_flag("E85|E619", "FIC10MEN", "CHECK")
#> Error in data %>% construct_cause_flag("E85|E619", "FIC10MEN", "CHECK"): could not find function "%>%"