Description Usage Arguments Details Value Examples

Computes mean, sd and se for each sub-group (indicated by `grp`

)
of `dv`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |

`x` |
A (grouped) data frame. |

`dv` |
Name of the dependent variable, for which the mean value, grouped
by |

`grp` |
Factor with the cross-classifying variable, where |

`weights` |
Name of variable in |

`digits` |
Numeric, amount of digits after decimal point when rounding estimates and values. |

`out` |
Character vector, indicating whether the results should be printed
to console ( |

`encoding` |
Character vector, indicating the charset encoding used
for variable and value labels. Default is |

`file` |
Destination file, if the output should be saved as file.
Only used when |

This function performs a One-Way-Anova with `dv`

as dependent
and `grp`

as independent variable, by calling
`lm(count ~ as.factor(grp))`

. Then `contrast`

is called to get p-values for each sub-group. P-values indicate whether
each group-mean is significantly different from the total mean.

For non-grouped data frames, `means_by_group()`

returns a data frame with
following columns: `term`

, `mean`

, `N`

, `std.dev`

,
`std.error`

and `p.value`

. For grouped data frames, returns
a list of such data frames.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
data(efc)
means_by_group(efc, c12hour, e42dep)
data(iris)
means_by_group(iris, Sepal.Width, Species)
# also works for grouped data frames
if (require("dplyr")) {
efc %>%
group_by(c172code) %>%
means_by_group(c12hour, e42dep)
}
# weighting
efc$weight <- abs(rnorm(n = nrow(efc), mean = 1, sd = .5))
means_by_group(efc, c12hour, e42dep, weights = weight)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.