mat_add_perc: Add percentage column

mat_add_percR Documentation

Add percentage column

Description

Add percentage column

Usage

mat_add_perc(df, ..., .name = n, warn_grouped = TRUE)

Arguments

df

data

.name

Name of n

warn_grouped

Should warn that already grouped? Default TRUE

...

variables to group for

Examples

 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)

MatthieuStigler/matPkg documentation built on Sept. 19, 2024, 5:19 a.m.