icd9Sort: sort short-form icd9 codes

Description Usage Arguments Details Value

View source: R/ranges.R

Description

Sorts lists of numeric only, V or E codes. Note that a simple numeric sort does not work for ICD-9 codes, since "162" > "1620", and also V codes precede E codes.

Usage

1
2
3
4
5
icd9Sort(icd9, isShort = icd9GuessIsShort(icd9))

icd9SortShort(icd9Short)

icd9SortDecimal(icd9Decimal)

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.

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"

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"

Details

Implementation used fast built-in sort, then shuffles the E codes to the end.

Value

sorted vector of ICD-9 codes. Numeric, then E codes, then V codes.


icd9 documentation built on May 20, 2017, 12:31 a.m.

Search within the icd9 package
Search all R packages, documentation and source code