add_perc: Add percentage column

View source: R/summary.R

add_percR Documentation

Add percentage column

Description

Adds a percentage column based on the counts in the count_col. Automatically quoted. .total is to specify a total count (e.g. in chooseany columns, where the sum is not the same as the total N) name is the name of the column to add margins is which columns to add margins for (tidy-select)

Usage

add_perc(
  x,
  count_col = NULL,
  .total = NULL,
  name = "perc",
  margins = NULL,
  format = TRUE
)

Arguments

x

The dataset

count_col

The name of the column (tidy-select) that contains which column should be counted

.total

(optional) The name of the column containing totals

name

The name of the new column being added with the percentage (default: "perc")

format

rwash/surveys documentation built on Sept. 18, 2023, 11:31 p.m.