percs_by_group | R Documentation |
Transform a vector of counts and a vector of groups into a vector of proportions or percentages within groups.
percs_by_group(x, group)
props_by_group(x, group)
x |
A vector of counts |
group |
A vector to determine groups. |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.