Learn R Programming

icd (version 3.3)

as.decimal_diag: Get or set whether ICD codes have have an attribute indicating 'short' or 'decimal' format

Description

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

Usage

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, must_work = FALSE)

is.icd_decimal_diag(x, must_work = FALSE)

is.short_diag(x, must_work = FALSE)

is.icd_short_diag(x, must_work = FALSE)

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.

must_work

single logical value, if FALSE (the default) this may return NULL if the attribute is not present. If TRUE, then either TRUE or FALSE is returned.

Getting the attribute

is.short_diag tests for presence of an attribute, not whether the code is a valid ICD code. If must_work is TRUE then NULL (i.e. no attribute set) returns FALSE, otherwise NULL is returned. To test validity, 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.

Examples

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab