## Ficticious Data ##
library(furniture)
library(tidyverse)
x <- runif(1000)
y <- rnorm(1000)
z <- factor(sample(c(0,1), 1000, replace=TRUE))
a <- factor(sample(c(1,2), 1000, replace=TRUE))
df <- data.frame(x, y, z, a)
## Simple
simple_table1(df, x, y, z, a)
## Stratified
## both below are the same
simple_table1(df, x, y, z,
splitby = ~ a)
simple_table1(df, x, y, z,
splitby = "a")
## Adjust variables within function
simple_table1(df, ifelse(x > 0, 1, 0), z,
var_names = c("Dich X", "Z"))
Run the code above in your browser using DataLab