clean.data: Clean ICD10 codes

Description Usage Arguments Examples

View source: R/hospCodesFns.R

Description

In ICD10 codes remove unwanted trailing characters.

Usage

1

Arguments

data
cols

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
##---- 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 (data, cols) 
{
    for (i in cols) {
        data[, i] <- gsub("-$", "0", data[, i])
        data[, i] <- gsub("X$", "0", data[, i])
        data[, i] <- gsub("X.$", "0", data[, i])
        data[, i] <- substring(data[, i], 1, 4)
    }
    data
  }

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