as.decimal_diag: Get or set whether ICD codes have have an attribute...

Description Usage Arguments Getting the attribute Setting the attribute Examples

View source: R/attr.R

Description

Get or set whether ICD codes have have an attribute indicating 'short' or 'decimal' format

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

Arguments

x

ICD data

value

TRUE or FALSE, default is TRUE which sets the attribute to whatever is indicated in the function name. See examples.

Getting the attribute

is.short_diag tests for presence of an attribute, not whether the code is a valid ICD code. To test validity of the codes themselves, see is_valid.

Setting the attribute

Similarly, as.icd_short_diag and as.icd_decimal_diag set the attribute, but do not convert the codes themselves. For conversion between 'short' and 'decimal' forms, use decimal_to_short and short_to_decimal.

The attribute icd_short_code should be either TRUE or FALSE. There is no attribute named icd_decimal_code. These functions set and get the attribute safely. If the attribute is not present, both is.icd_short_diag and is.icd_decimal_diag (or their synonyms is.short_diag and is.decimal_diag) will return FALSE.

Examples

1
2
3
4
5
6
7
8
9
library(icd)
as.icd_short_diag("6670")
as.icd_short_diag("667.0") # no warning or error!
is.icd_short_diag(decimal_to_short("667.0"))
decimal_type_code <- as.icd_short_diag("667.0", FALSE)
stopifnot(is.icd_decimal_diag(decimal_type_code))
codes <- as.icd9(c("100.1", "441.3"))
codes <- as.decimal_diag(codes)
codes

Example output

The 'icd9' package is 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 highly recommended to run the command: 'remove.packages("icd9")'
[1] "6670"
attr(,"icd_short_diag")
[1] TRUE
[1] "667.0"
attr(,"icd_short_diag")
[1] TRUE
[1] TRUE
[1] "100.1" "441.3"

icd documentation built on July 2, 2020, 4:07 a.m.