Learn R Programming

icd (version 2.4.1)

icd9_order_short: Get order of short-form ICD-9 codes

Description

Puts E codes after V codes. NA values can't be ordered and are dropped with a warning if found.

Usage

icd9_order_short(x)

Arguments

x

vector or factor of ICD-9 codes

Value

vector of integers with length of the non-NA values in x

Examples

Run this code
# NOT RUN {
x <- icd:::generate_random_decimal_icd9(1e4)
system.time(icd:::icd9_sort_cpp(x)) # vastly quicker
system.time(icd:::icd9_order_short(x))
if (require("microbenchmark", quietly = TRUE)) {
  # fastmatch was fractionally faster, but either is very slow
  microbenchmark(icd:::icd9_order_short(x),
                 icd:::icd9_order_short_r(x),
                 times = 10)
  # C++ method (which also ignores NA values) is 100x faster.
}
# }

Run the code above in your browser using DataLab