Description Usage Arguments Value Examples
View source: R/multiple_states.R
Sometimes, diseases may have multiple states, for example a different stage of cancer or kidney disease. This function processes comorbid_columns that have multiple states
and processes them to a new master_str which is made up of 0s and 1s only.
The intended use is to run this on data that has multiple states, merge the master_str to the original data on the basis of the comorbid_column.
The make_stem can then be run on this data.
| 1 | multiple_state_processor(comorbid_column, dis_names = NULL)
 | 
| comorbid_column | A vector of character strings made up of numbers 0-9 or of factors coercible to character, all should be identical lengths. | 
| dis_names | A list of disease names associated with each position as used in  | 
If dis_names is passed, then a list, the first element of which is a data.frame, the second is a vector of new names.
If only comorbid_column is passed, then only a data.frame is returned  which includes:
The original comorbid_column passed to the function
The frequency of that comorbid_column
master_strThe new string that has been returned
| 1 2 3 4 5 | comorbid_column <- c('23001', '11101', '21011', '22111', '23001')
disease_names = c('first', 'second', 'third', 'fourth', 'fifth')
ms <- multiple_state_processor(comorbid_column) #no names
ms <- multiple_state_processor(comorbid_column, dis_names = disease_names)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.