layered_mean: compute a mean of means

Description Usage Arguments Value Examples

View source: R/layered_mean.R

Description

compute a mean of means

Usage

1
layered_mean(x, first_group_by, then_group_by, value_str)

Arguments

x

a tbl() to compute proportions

first_group_by

vector of variabels names strings. the first mean would be grouped by them.

then_group_by

vector of variabels names strings. the second mean would be grouped by them. aought to be shorter.

value_str

the variable on which to mean

Value

A tbl, grouped the same way as then_group_by with avg and n variables.

Examples

1
2
3
4
cars <- mtcars %>%
layered_mean(value_str = "qsec",
first_group_by = c("vs","am","gear"),
then_group_by = c("vs","am"))

sarid-ins/saridr documentation built on Nov. 10, 2020, 9:07 p.m.