combine_n_pct: Combine N and Percent Columns for Accessibility

combine_n_pctR Documentation

Combine N and Percent Columns for Accessibility

Description

Combine N and Percent Columns for Accessibility

Usage

combine_n_pct(df, n, pct, name, remove = TRUE, na_replace = NULL)

Arguments

df

A data frame that has already been sent to fmt_table()

n

The unquoted name of the column containing count values

pct

The unquoted name of the column containing percentage values

name

The name of the new combined column to be created

remove

Logical. Should the existing n and pct columns be removed?

na_replace

Character string representing how missing values should be represented.

Value

A data frame.

Examples

pcts <- tibble::tibble(Program = c("A", "B", "C", "D", "E", "F"),
               n = 0:5,
               p = 0.5 * (0:5))
pcts |>
  fmt_table() |>
  combine_n_pct(n = n, pct = p, name = "States")


ratlas documentation built on April 4, 2025, 12:22 a.m.