Description Usage Arguments Value Examples

View source: R/stem_generator.R

Generate disease stems on the basis of combination frequency (if no `outcome_positions`

is passed) or the proportion of records associated with an outcome event (if `outcome_positions`

is passed).

1 2 3 4 5 6 7 8 9 | ```
stem_generator(
poscolumn,
max_combos = 3,
all_diseases,
outcome_positions = 0,
min_freq = 0,
tots,
use_outcome = FALSE
)
``` |

`poscolumn` |
Vector of numbers which describe position of 1s in a comorbid string, generated using |

`max_combos` |
Number of maximum combinations to attempt. |

`all_diseases` |
List of positions associated with each disease, generated using |

`outcome_positions` |
Numeric vector where each number refers to a record that suffered a particular outcome. |

`min_freq` |
Number between 0 and 1; minimum proportion of code combinations to be included in the stem. If |

`tots` |
Total number of records included to allow calculation of disease frequency. |

`use_outcome` |
Logical if to use outcome variable for stem generation. |

A dataframe with the `main_stem`

for each pattern up to a maximum set in `max_combos`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
positions = list(c(1,2,3,4), c(3), c(3), c(2,3))
disease_counts = list(c(1), c(1,4), c(1,2,3,4), c(1))
# generate stems on basis of frequency
stem_generator(poscolumn = positions,
max_combos = 2,
all_diseases = disease_counts,
outcome_positions = 0, tots=4)
# generate stems on basis of outcome
stem_generator(poscolumn = positions,
max_combos = 2,
all_diseases = disease_counts,
outcome_positions = c(2,3,4), tots = 4)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.