Skip to contents

Count injury cases or episodes. Generally an episode shoulde be:

  • Main diagnosis is between S00 to T78

  • It's an acute injury ie. hastegrad is 1

  • Posibility to select days from previous to the following injury of similar code for multiple injuries

Usage

count_case(
  d,
  period = 0,
  id = "lopenr",
  date.col = "innDato",
  acute = FALSE,
  days = 0,
  diag.col = "hoveddiagnoser"
)

Arguments

d

Dataset that contain ICD-10 diagnosis codes

period

Representing 4-months period ie. first, second or third. Default is 0 to include data for the whole period else use 1, 2 or 3.

id

Columname representing unique id

date.col

Columname for date for filtering

acute

Default is FALSE. Use TRUE to include only acute patients ie. Hastegrad = 1

days

If diffence in days of registration should be considered ie. when a person has more than one registered injuries of the same ICD-10 code. This is to avoid counting similar injuries more than once.

diag.col

Columname of codes for main diagnosis

Value

When the value for arg days is other than 0, a new column called dup is created ie. duplicated cases. Hence dup == 1 indicates the row is duplicated as defined within the specified days.

Examples

if (FALSE) { # \dontrun{
dd <- count_case(dt1, period = 1:2, acute = TRUE)
dd <- count_case(dt1, acute = TRUE, days = 3)
} # }