Nothing
# R4VN full workflow -------------------------------------------------------
set.seed(2026)
n <- 300
patient <- data.frame(
id = seq_len(n),
age = round(rnorm(n, 45, 13)),
sex = factor(sample(c("Female", "Male"), n, TRUE)),
agegroup = factor(sample(c("<40", "40-59", "60+"), n, TRUE)),
bmi = round(rnorm(n, 23, 3.5), 1),
smoking = factor(sample(c("No", "Yes"), n, TRUE, c(.7, .3))),
sbp = round(rnorm(n, 128, 18)),
dbp = round(rnorm(n, 80, 11))
)
patient$hypertension <- factor(
patient$sbp >= 140 | patient$dbp >= 90,
levels = c(FALSE, TRUE), labels = c("No", "Yes")
)
usedf(patient)
labvar(age, label = "Age in years")
labvar(sex, label = "Sex", ref = "Female")
labvar(hypertension, label = "Hypertension", ref = "No")
genvar(pulse_pressure = sbp - dbp, label = "Pulse pressure")
describe(age, sex, hypertension, pulse_pressure)
tab1(smoking, hypertension, by = c(sex, agegroup))
sum1(age, bmi, sbp, by = c(sex, agegroup))
ttest(sbp, by = hypertension)
ranksum(bmi, by = hypertension)
publication_table <- tab(
vars = vars(c.age, b2.sex, q.bmi, b2.smoking),
by = hypertension,
test = TRUE,
or = TRUE,
event = "Yes",
show = FALSE
)
example_file <- tempfile("R4VN_example_", fileext = ".html")
ex <- tabexport(publication_table, export = "html", file = example_file, open = FALSE)
unlink(ex$files)
if (interactive()) View(patient)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.