build_df_cooc | R Documentation |
Compute monthly co-occurrence matrix
build_df_cooc(
df_ehr,
uniq_codes = NULL,
n_cores = 1,
min_code_freq = 5,
gc_before_parallel = TRUE
)
df_ehr |
Input data frame, monthly counts with columns Patient, Month, Parent_Code, Count |
uniq_codes |
Not required, useful for sql_cooc function |
n_cores |
Number of cores |
min_code_freq |
Filter matrix based on feature frequency |
gc_before_parallel |
Call garbage collector before computation |
Co-occurrence sparse matrix
df_ehr = data.frame(Month = c(1, 1, 1, 2, 2, 3, 3, 4, 4),
Patient = c(1, 1, 2, 1, 2, 1, 1, 3, 4),
Parent_Code = c('C1', 'C2', 'C2', 'C1', 'C1', 'C1', 'C2',
'C3', 'C4'),
Count = 1:9)
spm_cooc = build_df_cooc(df_ehr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.