percs_by_group {ggformula} | R Documentation |
Compute groupwise proportions and percents
Description
Transform a vector of counts and a vector of groups into a vector of proportions or percentages within groups.
Usage
percs_by_group(x, group)
props_by_group(x, group)
Arguments
x |
A vector of counts |
group |
A vector to determine groups. |
Examples
x <- c(20, 30, 30, 70)
g1 <- c("A", "A", "B", "B")
g2 <- c("A", "B", "A", "B")
props_by_group(x, g1)
percs_by_group(x, g1)
props_by_group(x, g2)
[Package ggformula version 0.12.0 Index]