R/make_regex.R
make_regex.Rd
Make regural expression classifications from LIKE% classifications
make_regex(.data, classname, diagnosis, diagnosis.rm, sep = ", ")
.data | holds the data which has variable names given as 'classname' and 'diagnosis'. Must be convertible to a tibble. |
---|---|
classname | name of the variable containing names/labels for the classes |
diagnosis | name of the variable containing strings in LIKE% -format |
diagnosis.rm | name of the variable defining exceptions of ICD-codes not to be included in the class |
sep | separator of different diagnoses in 'diagnosis'. String. |
returns a tibble with regular expression definitions
Other help functions:
get_classification_name()
,
get_na_vars()
,
get_var_types()
,
left_join_replace_na()
,
replace_na_by_type()
if (FALSE) { # We load classification here excelfile <- readxl::read_excel("./datas/disease_classification.xlsx") cl9 <- excelfile %>% make_regex(classname=Lyhenne,diagnosis=sairdiag_icd9,diagnosis.rm=sairdiagpl_icd9) %>% mutate(icd="icd9") cl10 <- excelfile %>% make_regex(classname=Lyhenne,diagnosis=sairdiag,diagnosis.rm=sairdiagpl) %>% mutate(icd="icd10") sel_classes<-bind_rows(cl9,cl10) %>% mutate(classification="own_definition") }