make_stem: Make combinations of diseases ('stems') up to a maximum level

Description Usage Arguments Value Examples

View source: R/make_stem.R

Description

Generate disease stems from a vector of character strings.

Usage

1
2
3
4
5
6
7
make_stem(
  comorbid_column,
  max = "default",
  min_freq = 0,
  outcome_column = NULL,
  use_outcome = FALSE
)

Arguments

comorbid_column

A vector of character strings made up of 0s and 1s, or of factors coercible to character, all should be identical lengths. If data contains elements with multiple states (i.e. where a character element may have a value of >1), then please see multiple_state_processor.

max

The maximum number of combinations to be considered, if left as 'default' then a maximum based on code frequency will be calculated using determine_default_combinations().

min_freq

Number between 0 and 1; minimum proportion of code combinations to be included in the stem. If outcome_column is passed, min_freq is the minimum event rate per combination to be considered.

outcome_column

A numeric vector one if outcome occurred and zero if outcome did not occur. Should be the same length as comorbid_column with each element relating to the same record as the comorbid_column. If outcome_column is passed, then the stem will be generated based on combinations with the highest event rate.

use_outcome

Logical if to use outcome variable for stem generation.

Value

data.frame with one row per unique comorbid_string pattern and columns: comorbid_string pattern, frequency of string pattern, positions within the pattern, stem and if frequency or outcome was used.

Examples

1
2
3
comorbid_column <- c('00010', '01000', '01110', '11101')

make_stem(comorbid_column, max='default', min_freq = 0, outcome_column=NULL)

AJFOWLER/comorbidgroupr documentation built on May 11, 2021, 6:01 a.m.