ICDwordmatch: ICD10 word match against patient codes

Usage Arguments Details Author(s) Examples

View source: R/hospCodesFns.R

Usage

1
ICDwordmatch(ICD10)

Arguments

ICD10

Array with Group, Code and Description columns.

Details

Regular expression to search in Description and Group names for a word match to the hard-coded risk factor list, and then return the relevant Code. The risk factor words to match are cancer, cathet, dialys, low birth, preterm, prematurity, intravenous.

Author(s)

N Green

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (ICD10) 
{
    RFcodes <- list()
    cat <- c("cancer", "cathet", "dialys", "low birth", "preterm", 
        "prematurity", "^intravenous")
    for (i in seq_along(cat)) {
        catmod <- paste("(?i)", cat[i], sep = "")
        RFrows <- unique(c(grep(catmod, ICD10$Group, fixed = FALSE), 
            grep(catmod, ICD10$Description, fixed = FALSE)))
        RFcodes[[i]] <- ICD10$Code[RFrows]
    }
    names(RFcodes) <- cat
    RFcodes
  }

n8thangreen/HESmanip documentation built on March 21, 2020, 12:20 a.m.