Learn R Programming

comorbidity (version 0.0.3)

sample_diag_icd10: Simulate ICD-10 diagnostic codes

Description

A simple function to simulate ICD-10 diagnostic codes at random.

Usage

sample_diag_icd10(n = 1, version = "2011")

Arguments

n

Number of ICD-10 codes to simulate.

version

The version of the ICD-10 coding scheme to use. Possible choices are 2009 and 2011; defaults to 2011. See comorbidity::icd10_2009 and comorbidity::icd10_2011 for further information on the different schemes.

Value

A vector of n ICD-10 diagnostic codes.

Examples

Run this code
# NOT RUN {
# Simulate 10 ICD-10 codes
sample_diag_icd10(10)

# Simulate a tidy dataset with 15 individuals and 200 rows
set.seed(1)
x <- data.frame(
  id = sample(1:15, size = 200, replace = TRUE),
  code = sample_diag_icd10(n = 200),
  stringsAsFactors = FALSE)
head(x)

# }

Run the code above in your browser using DataLab