prop: Calculate proportion

Description Usage Arguments Value Examples

View source: R/explore.R

Description

Calculate proportion

Usage

1
prop(x, na.rm = TRUE)

Arguments

x

Input variable

na.rm

If TRUE missing values are removed before calculation

Value

Proportion of first level for a factor and of the maximum value for numeric

Examples

1
2
3
4
prop(c(rep(1L, 10), rep(0L, 10)))
prop(c(rep(4, 10), rep(2, 10)))
prop(rep(0, 10))
prop(factor(c(rep("a", 20), rep("b", 10))))

radiant-rstats/radiant.data documentation built on Nov. 13, 2018, 6:57 a.m.