add_prop: Add proportion to counts

View source: R/add_prop.R

add_propR Documentation

Add proportion to counts

Description

Add proportion to counts

Usage

add_prop(
  df,
  n,
  ...,
  sort = TRUE,
  round = FALSE,
  denom = "sum",
  pct_formatting = FALSE,
  cum_prop = FALSE
)

Arguments

df

a tibble with counts

n

column of counts

...

variables to group by

sort

if TRUE will sort output in descending order of n

round

if TRUE will round to nearest percent

denom

denominator for calculating percent. If sum then will use sum of n otherwise will use value entered

pct_formatting

should percent formatting be applied

cum_prop

if TRUE will add column for cumulative percent

pct

if TRUE will add percent column

cum_sum

if TRUE will add column for cumulative sum

head

returns all values by default


scottfrechette/funcyfrech documentation built on Aug. 26, 2022, 9:13 a.m.