View source: R/stratified_randomization.R
| stratified_randomization | R Documentation |
Generates a randomized allocation schedule within each stratum.
stratified_randomization(data, strata, groups, seed = NULL)
data |
A data frame containing the study subjects. |
strata |
Character vector specifying one or more stratification variables. |
groups |
Character vector of treatment groups. |
seed |
Optional random seed. |
A tibble containing the original data with an additional treatment allocation column.
df <- data.frame(
ID = 1:20,
Sex = rep(c("Male","Female"), each = 10),
Age = rep(c("Young","Adult"), times = 10)
)
stratified_randomization(
data = df,
strata = c("Sex"),
groups = c("Control","Treatment"),
seed = 123
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.