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

# S3 method for icd9
[(x, ...)

# S3 method for icd9
[[(x, ...)

# S3 method for icd10
[(x, ...)

# S3 method for icd10
[[(x, ...)

Arguments

x

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

...

arguments passed on to other functions

Methods (by class)

  • icd9: Extract ICD-9 codes

  • icd9: Extract ICD-9 codes

  • icd10: Extract ICD-10 codes

  • icd10: Extract ICD-10 codes

Examples

x <- list(my_codes = as.icd9(c("V10.1", "441.1"))) x[1]
#> $my_codes #> [1] "V10.1" "441.1" #>
x[[1]]
#> [1] "V10.1" "441.1"
x[[1]][2]
#> [1] "441.1"
# 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]
#> [1] "B0234"
y[[2]]
#> [1] "B0234"
stopifnot(inherits(y[2], "icd10")) stopifnot(inherits(y[[2]], "icd10"))