--- title: "Clinical Workflows" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Clinical Workflows} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` This vignette shows practical combinations of `kstools` functions for common clinical programming tasks. ```{r} library(kstools) ``` ## 1. Incidence Rate and Proportion Comparisons ```{r} ks_eairdiff_mn(n1 = 10, n2 = 5, T1 = 100, T2 = 100) ks_newcombe_hs( x1 = 36L, n1 = 54L, x2 = 41L, n2 = 56L ) ``` Stratified alternatives: ```{r} ks_eairdiff_strata_mn( n1 = c(10, 5), n2 = c(5, 3), T1 = c(100, 80), T2 = c(100, 70) ) ks_newcombe_hs_strata( x1 = c(36L, 10L), n1 = c(54L, 30L), x2 = c(41L, 8L), n2 = c(56L, 30L) ) ``` ## 2. Randomization Design ```{r} w <- ks_williams( tmts_num = 4, tmt_names = c("Drug1A", "Drug2B", "ActCtrl", "Placebo"), sample_size = 24, seed_num = 20260408 ) w$design head(w$schedule) ``` ## 3. Data Loaders ```{r eval=FALSE} # one-shot load of multiple domains from RDS directory (returns a named list) dat <- ks_get_data(dm, ae, adlb, path = "data/rds") dm <- dat$dm # case-insensitive lookup works too dm <- ks_get_data(DM, path = "data/rds") # matches dm.rds, DM.RDS, etc. # or bulk by file type x <- ks_batch_load("data/rds", type = "rds") names(x) ``` These pieces can be mixed to build reproducible data review and reporting pipelines.