R/attr.R
as.decimal_diag.Rd
Get or set whether ICD codes have have an attribute indicating 'short' or 'decimal' format
as.decimal_diag(x, value = TRUE) as.icd_decimal_diag(x, value = TRUE) as.short_diag(x, value = TRUE) as.icd_short_diag(x, value = TRUE) is.decimal_diag(x) is.icd_decimal_diag(x) is.short_diag(x) is.icd_short_diag(x)
x | ICD data |
---|---|
value |
|
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
.
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
.
#> [1] "6670" #> attr(,"icd_short_diag") #> [1] TRUEas.icd_short_diag("667.0") # no warning or error!#> [1] "667.0" #> attr(,"icd_short_diag") #> [1] TRUE#> [1] TRUEdecimal_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#> [1] "100.1" "441.3"