This is the function which prepares the input data for the categorization, and forms the core of the package, along with the C++ matrix code. This is pure data manipulation and generalizable beyond medical data.
categorize_simple( x, map, id_name, code_name, return_df = FALSE, return_binary = FALSE, restore_id_order = TRUE, preserve_id_type = FALSE, comorbid_fun = comorbid_mat_mul_wide, ... )
x | Data frame containing a column for an 'id' and a column for a code, e.g., an ICD-10 code. |
---|---|
map | named list containing vectors of ICD-9 codes. E.g. the AHRQ ICD-9
comorbidities, contains |
id_name | The name of the |
code_name | String with name(s) of column(s) containing the codes. |
return_df | single logical value, if |
return_binary | Logical value, if |
restore_id_order | Logical value, if |
preserve_id_type | Single logical value, if |
comorbid_fun | function i.e. the function symbol (not character string) to be called to do the comorbidity calculation |
... | arguments passed on to other functions |
The roadmap for icd includes the optimized categorization component being packaged independently, and the comorbidity package taking on the front-end for doing ICD-code-based comorbidities. This is in discussion.
u <- uranium_pathology m <- icd10_map_ahrq u$icd10 <- decimal_to_short(u$icd10) j <- icd:::categorize_simple(u, m, id_name = "case", code_name = "icd10")