count_pct: Shortcut for adding percentages to 'dplyr::count' summaries

Description Usage Arguments

Description

This performs the equivalent of:

count(x, col) %>% mutate(pct=n/100, percent=scales::percent(pct))

Usage

1
count_pct(x, ..., wt = NULL, sort = TRUE)

Arguments

x

a tbl to count

...

variables to group by

wt

(Optional) If omitted, will count the number of rows. If specified, will perform a "weighted" tally by summing the (non-missing) values of variable wt.

sort

unlike dplyr::count this defaults to TRUE


kidman007/kraemR documentation built on May 8, 2019, 11:45 a.m.