desc_statby | R Documentation |
Computes descriptive statistics by groups for a measure variable.
desc_statby(data, measure.var, grps, ci = 0.95)
data |
a data frame. |
measure.var |
the name of a column containing the variable to be summarized. |
grps |
a character vector containing grouping variables; e.g.: grps = c("grp1", "grp2") |
ci |
the percent range of the confidence interval (default is 0.95). |
A data frame containing descriptive statistics, such as:
length: the number of elements in each group
min: minimum
max: maximum
median: median
mean: mean
iqr: interquartile range
mad: median absolute deviation (see ?MAD)
sd: standard deviation of the sample
se: standard error of the mean. It's calculated as the sample standard deviation divided by the root of the sample size.
ci: confidence interval of the mean
range: the range = max - min
cv: coefficient of variation, sd/mean
var: variance, sd^2
# Load data data("ToothGrowth") # Descriptive statistics res <- desc_statby(ToothGrowth, measure.var = "len", grps = c("dose", "supp")) head(res[, 1:10])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.