update project design
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# Simulate an ICU cohort for learning target trial emulation.
|
||||
# The simulation logic lives in R/simulate_icu_cohort.R.
|
||||
|
||||
# suppressPackageStartupMessages() keeps package startup text out of the console.
|
||||
# This makes the important output easier to read when learning.
|
||||
suppressPackageStartupMessages({
|
||||
library(skimr)
|
||||
})
|
||||
|
||||
# source() runs another R file.
|
||||
# After this line runs, simulate_icu_cohort() is available in this script.
|
||||
source("R/simulate_icu_cohort.R")
|
||||
|
||||
# This calls our reusable simulation function.
|
||||
# n_patients controls the number of rows.
|
||||
# seed controls reproducibility.
|
||||
icu_data <- simulate_icu_cohort(n_patients = 1000, seed = 20260531)
|
||||
|
||||
# cli::cli_alert_success() prints a nicely formatted success message.
|
||||
cli::cli_alert_success("Simulated an in-memory ICU cohort with {nrow(icu_data)} patients.")
|
||||
|
||||
# skim() gives a quick learner-friendly overview of the dataset.
|
||||
# It shows variable types, missingness, summary statistics, and small histograms.
|
||||
skim(icu_data)
|
||||
Reference in New Issue
Block a user