sample_diag {comorbidity} | R Documentation |
A simple function to simulate ICD-10 and ICD-9 diagnostic codes at random.
sample_diag(n = 1, version = "ICD10_2011")
n |
Number of ICD codes to simulate. |
version |
The version of the ICD coding scheme to use. Possible choices are |
A vector of n
ICD diagnostic codes.
# 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)