prop: Proportion of observations by group

Description Usage Arguments Value

View source: R/prop.R

Description

prop calculates the proportion of observations by group. This is analaguous to count which counts the number of rows by group. Alternatively, count is to table as prop is to prop.table.

Usage

1
2
3
prop(x, ..., wt = NULL, sort = FALSE)

prop_(x, vars, wt = NULL, sort = FALSE)

Arguments

x

A tbl.

wt

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

sort

If TRUE, sort output in descending order of n.

vars, ...

Variables to group by

Value

A tbl with the grouping variables and column .prop with the proportion in each group.


jrnold/rubbish documentation built on May 20, 2019, 2:05 a.m.