View source: R/balance_table.R
balance_table | R Documentation |
Creates balance table for the X variables across treatment status
balance_table(data, treatment)
data |
A data.frame, tibble or data.table |
treatment |
a string with treatment status column |
balance_table() performs t.test(X~treatment) for each X column in data. Every value of treatment i.e 1,2,3,...N is compared against control value (0) or the first value of the treatment column. For instance, If treatment column has values of (0,1,2,3), balance_table will return: the mean value of each treatment (for all X's), and the p_values of the t.test of (1,2,3) against treatment = 0.
A tibble with Mean_value of each treatment status and p_values
data <-data.frame(x1 = rnorm(n = 100, mean = 100, sd = 15), x2=rnorm(n = 100, mean = 65), treatment = rep(c(0,1,2,3,4), each = 20)) balance_table(data, "treatment")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.