freq_table: Frequencies Grouped by Another Column

Description Usage Arguments Value See Also Examples

View source: R/exploration.R

Description

Obtain the relative distribution of a categorical variable within the group member of a different variable.

Usage

1
freq_table(x, group_var, prop_var)

Arguments

x

a data frame

group_var

the variable to group by

prop_var

the variable over which to calculate the frequencies

Value

A data frame with both the absolute and the relative distribution of 'prop_var' within 'group_var'.

See Also

Inspired by SO question 24576515

Examples

1
mtcars %>% freq_table(vs, cyl)

EdwinTh/mytools documentation built on May 14, 2019, 7:41 a.m.