Learn R Programming

icd (version 2.2)

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))
# }
# NOT RUN {
# fastmatch was fractionally faster, but either is very slow
library(microbenchmark)
microbenchmark(icd9_order_short(x), 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