subset_icd: extract subset from ICD data

Description Usage Arguments Examples

Description

exactly the same as using x[n] or x[[n]] but preserves the ICD classes in result

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 method for class 'icd9'
x[...]

## S3 method for class 'icd9'
x[[...]]

## S3 method for class 'icd10'
x[...]

## S3 method for class 'icd10'
x[[...]]

Arguments

x

input data with list, vector, factor, and class set to an ICD type.

...

arguments passed on to other functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
x <- as.icd9(list(my_codes = c("V10.1", "441.1")))
x[1]
x[[1]]
x[[1]][2]
# subsetting a list should give the underlying data structure type,
# preserving the ICD class
stopifnot(!inherits(x[[1]], "list"))
stopifnot(!inherits(x[[1]][2], "list"))

y <- as.icd10(c("A01", "B0234"))
y[2]
y[[2]]
stopifnot(inherits(y[2], "icd10"))
stopifnot(inherits(y[[2]], "icd10"))

Example output

Welcome to the "icd" package for finding comorbidities and interpretation of ICD-9 and ICD-10 codes. Suggestions and contributions are welcome at https://github.com/jackwasey/icd .

See the vignettes and help for examples.

Please cite this package if you find it useful in your published work.
citation(package = "icd")

The 'icd9' package is now deprecated, and should be removed to avoid conflicts with 'icd'.
The 'icd' package up to version 2.1 contains tested versions of all the deprecated function names which overlap with those in the old
'icd9' package, e.g. 'icd9ComorbidAhrq'. It is strongly recommended to run the command:

            remove.packages("icd9")
$my_codes
[1] "V10.1" "441.1"

attr(,"class")
[1] "icd9" "list"
[1] "V10.1" "441.1"
[1] "441.1"
[1] "B0234"
attr(,"class")
[1] "icd10"     "character"
[1] "B0234"
attr(,"class")
[1] "icd10"     "character"

icd documentation built on March 18, 2018, 2:09 p.m.