mat_add_perc | R Documentation |
Add percentage column
mat_add_perc(df, ..., .name = n, warn_grouped = TRUE)
df |
data |
.name |
Name of n |
warn_grouped |
Should warn that already grouped? Default TRUE |
... |
variables to group for |
library(tibble)
library(magrittr)
library(dplyr)
df <- tibble(group = rep(letters[1:2], each = 2),
n = c(3, 2,3, 5))
df %>% mat_add_perc()
df %>% mat_add_perc(group)
df %>% rename(N=n) %>% mat_add_perc(.name = N)
df %>% rename(N=n) %>% mat_add_perc(group, .name = N)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.