# prop: Calculate a proportion or a ratio from a vector. In leebunce/leebunce: A collection of functions used by Lee Bunce

## Description

Calculate a proportion or a ratio from a vector.

## Usage

 ```1 2 3 4``` ```prop(x, numerator, denominator, percent = TRUE, round = TRUE, digits = 1) ratio(x, numerator, denominator, round = FALSE, digits = 1) ```

## Arguments

 `x` A vector to calculate a proportion or ratio from. `numerator` A vector of elements to count in the numerator. `denominator` For prop this is a vector of elements to count in the denominator in addition to those included in the numerator. For ratio the values given by the numerator argument are not added. `round` A logical indicating whether to round the output. `digits` The number of decimal places to round to, passed to the round function. `percect` A logical indicating whether to present the output as a percentage rather than a proportion..

## Value

prop returns the proportion of specified values, presented as a percentage or raw proportion.

ratio returns a ratio.

## Examples

 ```1 2 3 4 5 6``` ```example <- c(T, T, T, T, T, F, F, F, NA) prop(x = example, numerator = T, denominator = F) prop(x = example, numerator = T, denominator = F, percent = FALSE, digits = 3) ratio(example, T, F) ratio(example, T, F, round = TRUE) ```

leebunce/leebunce documentation built on Nov. 8, 2018, 8:51 p.m.