Computes classification table and attaches it to original data. Data stays in long format.

classify_codes(.data, codes, diag_tbl)

Arguments

.data

tibble of register data which we want to study

diag_tbl

tibble which holds the classification details: needs to have variables 'regex' and 'label' 'regex' must hold a string with a regular expression defining classes. 'regex.rm' is optional, defines exceptions to 'regex' (these are not in the group they are named in) 'label' defines the names of the variables of classes (e.g. comorbidity indicators)

icdcodes

name of the variable holding ICD-codes

Value

Examples

if (FALSE) { x<-1 }