icd9IsValid: check whether ICD-9 codes are syntactically valid

Description Usage Arguments Details Value Three-digit validation See Also Examples

View source: R/valid.R

Description

This does not check whether the code coresponds to a real ICD-9-CM billing code, or parent grouping. For that, see icd9IsReal.

Factors are accepted, and since the validation is done with grepl these are handled correctly.

Currently, there is a limitation on NA values. Calling with NA (which is a logical vector of length one by default) fails, because it is not a string. This is rarely of significance in real life, since the NA will be part of a character vector of codes, and will therefore be cast already to NA_character

NA values result in a return value of FALSE.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19

Arguments

icd9

is a character vector or factor of ICD-9 codes. If fewer than five characters is given in a code, then the digits are greedily assigned to hundreds, then tens, then units, before the decimal parts. E.g. "10" becomes "010", not "0010".

isShort

single logical value which determines whether the ICD-9 code provided is in short (TRUE) or decimal (FALSE) form. Where reasonable, this is guessed from the input data.

icd9Decimal

character vector of ICD-9 codes. If fewer than five characters is given in a code, then the digits are greedily assigned to hundreds, then tens, then units, before the decimal parts. E.g. "10" becomes "010", not "0010"

icd9Short

is a character vector of ICD-9 codes. If fewer than five characters is given in a code, then the digits are greedily assigned to hundreds, then tens, then units, before the decimal parts. E.g. "10" becomes "010", not "0010"

major

character vector of 'major' part of ICD-9 codes, i.e. that part which falls before the decimal point, in decimal notation. (In 5 digit notation, the 'major' part is be the first three characters (with leading zeroes), and includes V or E prefix. xyz

Details

Leading zeroes in the decimal form are not ambiguous. Although integer ICD-9 codes could be intended by the user, there is a difference between 100, 100.0, 100.00. Therefore a warning is given if a numeric value is provided

Value

logical vector with TRUE or FALSE for each icd9 code provided according to its validity

Three-digit validation

isValidMajor validates just the 'major' three-digit part of an ICD-9 code. This can in fact be provided as a numeric, since there is no ambiguity. Numeric-only codes should be one to three digitis, V codes are followed by one or two digits, and E codes always by three digits between 800 and 999.

See Also

icd9IsValidDecimal, icd9IsValidShort, http://www.stata.com/users/wgould/icd9/icd9.hlp urlhttp://www.sascommunity.org/wiki/Validate_the_format_of_ICD-9_codes

Other ICD9 validation: icd9IsValidMapping

Examples

1
2
3
4
  icd9IsValidShort(c("", "1", "22", "333", "4444", "123.45", "V",
                     "V2", "V34", "V567", "E", "E1", "E70", "E"))
  icd9IsValidMajor(c("", "1", "22", "333", "4444", "123.45", "V",
                     "V2", "V34", "V567", "E", "E1", "E70", "E"))

icd9 documentation built on May 30, 2017, 2:25 a.m.