| means_by_group | R Documentation |
Computes summary table of means by groups.
means_by_group(x, ...) ## S3 method for class 'numeric' means_by_group(x, group = NULL, ci = 0.95, weights = NULL, digits = NULL, ...) ## S3 method for class 'data.frame' means_by_group( x, select = NULL, group = NULL, ci = 0.95, weights = NULL, digits = NULL, exclude = NULL, ignore_case = FALSE, regex = FALSE, verbose = TRUE, ... )
x |
A vector or a data frame. |
... |
Currently not used |
group |
If |
ci |
Level of confidence interval for mean estimates. Default is |
weights |
If |
digits |
Optional scalar, indicating the amount of digits after decimal point when rounding estimates and values. |
select |
Variables that will be included when performing the required tasks. Can be either
If |
exclude |
See |
ignore_case |
Logical, if |
regex |
Logical, if |
verbose |
Toggle warnings. |
This function is comparable to aggregate(x, group, mean), but provides
some further information, including summary statistics from a One-Way-ANOVA
using x as dependent and group as independent variable. emmeans::contrast()
is used to get p-values for each sub-group. P-values indicate whether each
group-mean is significantly different from the total mean.
A data frame with information on mean and further summary statistics for each sub-group.
data(efc) means_by_group(efc, "c12hour", "e42dep") data(iris) means_by_group(iris, "Sepal.Width", "Species") # weighting efc$weight <- abs(rnorm(n = nrow(efc), mean = 1, sd = .5)) means_by_group(efc, "c12hour", "e42dep", weights = "weight")