Skip to contents

Select codes from column consisting ICD-10 codes that meet the requirement for injury codes ie. between S00 to T78

Usage

get_valid_codes(
  d,
  select.col = "hoveddiagnoser",
  create.col = "hovdiag",
  split = " ",
  keep = FALSE
)

Arguments

d

Dataset

select.col

Columnames from dataset with ICD codes to be controlled for. Default is hoveddiagnoser

create.col

New columnames consisting logical value to indicate that at least one of these codes S00 to T78 exists ie. TRUE means one or more of the codes in select.col is between S00 to T78. Default is hovdiag

split

Symbols for splitting the codes when there are multiple codes in the column. Default is whitespace ie. " "

keep

Split multiple codes and keep in its own column. Default is FALSE.

Value

Original column will have suffix *.old.

Examples

if (FALSE) { # \dontrun{
d1 <- get_valid_codes(dt = dd, "hoveddiagnoser", "hovdiag")
} # }