describeBy | R Documentation |
Descriptive statistics and univariable association tests
describeBy(
data,
var.names,
var.labels = var.names,
by1,
by2 = NULL,
total = c("top", "bottom", "none"),
Missing = TRUE,
test = TRUE,
digits = 0,
total.digits = 0,
p.digits = 3,
bold_pval = FALSE,
sig.level = 0.05,
dispersion = c("sd", "se"),
stats = c("parametric", "non-parametric"),
per = "col",
simulate.p.value = FALSE,
B = 2000,
bold_var = TRUE,
fill = FALSE
)
data |
data.frame to produce descriptive statistics |
var.names |
variable names of interest in |
var.labels |
variable descriptions. Uses |
by1 |
factor to split other variables by in |
by2 |
optional second factor to split other variables by |
total |
add a row showing the total counts of each |
Missing |
logical; if |
test |
logical; if |
digits |
number of digits to round descriptive statistics. Supply a single value to round all variables to the same number of digits, or a vector of values to supply different rounding per variable. |
total.digits |
number of digits to round the total count percentages |
p.digits |
number of digits to round univariable test p-value |
bold_pval |
logical; if |
sig.level |
significance level; default 0.05 |
dispersion |
measure of variability, either "sd" (default) or "se". |
stats |
either "parametric" (default) or "non-parametric" univariable tests are performed for continuous variables. We use the parametric one-way test or the non-parametric Kruskal-Wallis test. |
per |
print column ("col") or row ("row") percentages. Suppress percentages with "none". |
simulate.p.value |
passed to |
B |
passed to |
bold_var |
logical; if |
fill |
logical; if |
Takes variables from data
and returns descriptive statistics split on
factor by1
.
A table with descriptive statistics for continuous and categorical variables and relevant univariable association tests
Aline Talhouk
mtcars$cyl <- as.factor(mtcars$cyl)
mtcars$vs <- as.character(mtcars$vs)
Amisc::describeBy(data = mtcars, var.names = c("vs", "hp"), by1 = "cyl",
Missing = TRUE, dispersion = "sd", stats = "parametric")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.