sample_diag {comorbidity} | R Documentation |
Simulate ICD-10 and ICD-9 diagnostic codes
Description
A simple function to simulate ICD-10 and ICD-9 diagnostic codes at random.
Usage
sample_diag(n = 1, version = "ICD10_2011")
Arguments
n |
Number of ICD codes to simulate. |
version |
The version of the ICD coding scheme to use. Possible choices are |
Value
A vector of n
ICD diagnostic codes.
Examples
# Simulate 10 ICD-10 codes
sample_diag(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(n = 200),
stringsAsFactors = FALSE
)
head(x)
[Package comorbidity version 1.1.0 Index]