In some situations, count summaries may want to see distinct counts by a variable like subject. For example, the number of subjects in a population who had a particular adverse event. set_distinct_by allows you to set the by variables used to determine a distinct count.

set_distinct_by(e, distinct_by)

Arguments

e A count_layer/shift_layer object Variable(s) to get the distinct data.

Value

The layer object with

Details

When a distinct_by value is set, distinct counts will be used by default. If you wish to combine distinct and not distinct counts, you can choose which to display in your f_str objects using n, pct, distinct, and distinct_pct.

Examples

#Load in pipe
library(magrittr)

tplyr_table(mtcars, gear) %>%
#> 3 8          " 3 ( 75.0%)" " 0 (  0.0%… " 2 ( 50.0%…               1           3