first_date_icd: Find first date of diagnosis using ICD-codes

Description Usage Arguments Examples

View source: R/first_date.R

Description

This function allows you to find the first date of a diagnosis using ICD-codes. Can return the full data or just the index data and patient id.

Usage

1
2
3
4
5
6
7
8
first_date_icd(
  .data,
  icd,
  new_variable,
  primary = TRUE,
  secondary = TRUE,
  keep = FALSE
)

Arguments

.data

A tibble with data in QTF-format.

icd

A character vector (or scalar) with ICD-codes that should be identified in the data.

new_variable

A character string with the column name for the new variable.

keep

Returns the full data, including the new date variable. Defaults to FALSE.

Examples

1
2
data(data_icd)
data_icd %>% combine_sdia() %>% first_date_icd("L405", "psa")

liljamathias/QRfunctions documentation built on Jan. 20, 2021, 1:32 a.m.