add_prop: Add proportions

View source: R/add-prop.R

add_propR 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))

campfin documentation built on Oct. 20, 2023, 5:06 p.m.