add_prop {campfin}R Documentation

Add proportions

Description

Use prop.table() to add a proportion column to a dplyr::count() tibble.

Usage

add_prop(.data, n, sum = FALSE)

Arguments

.data

A data frame with a count column.

n

The column name with a count, usually n from dplyr::count().

sum

Should cumsum() be called on the new p column.

Details

mean(x %in% y)

Value

A data frame with the new column p.

Examples

add_prop(dplyr::count(ggplot2::diamonds, cut))

[Package campfin version 1.0.11 Index]