View source: R/make_sample_data.R
| make_sample_data | R Documentation |
Creates a data frame with randomly generated patient data suitable for testing cardiovascular risk calculations. The function generates realistic ranges for all standard cardiovascular risk factors.
make_sample_data(n = 100)
n |
Number of rows to generate (default: 100) |
A data frame with n rows and the following columns:
Sequential patient identifier (1 to n)
Patient age in years (30-79)
Sex at birth ("female" or "male")
Patient race ("white", "aa", or "other")
Systolic blood pressure in mm Hg (90-200)
Blood pressure medication status (TRUE/FALSE)
Total cholesterol in mg/dL (130-320)
HDL cholesterol in mg/dL (20-100)
Lipid medication status (TRUE/FALSE)
Diabetes status (TRUE/FALSE)
Smoking status (TRUE/FALSE)
Estimated glomerular filtration rate in mL/min/1.73m2 (15-140)
Body mass index in kg/m2 (18.5-39.9)
Hemoglobin A1c percentage (4.5-15.0 or NA)
Urine albumin-to-creatinine ratio in mg/g (0.1-25000 or NA)
ZIP code (30 valid codes or NA)
library(CVrisk)
# Generate default 100 rows
sample_data <- make_sample_data()
# Generate 50 rows
sample_data_50 <- make_sample_data(n = 50)
# Use with compute_CVrisk
## Not run:
data <- make_sample_data(n = 10)
result <- compute_CVrisk(
data,
scores = "ascvd_10y_accaha",
age = "age",
gender = "sex",
race = "race",
sbp = "sbp",
totchol = "totchol",
hdl = "hdl",
bp_med = "bp_med",
smoker = "smoker",
diabetes = "diabetes"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.