Learn R Programming

ratlas (version 0.1.1)

combine_n_pct: 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)

Value

A data frame.

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.

Examples

Run this code
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")

Run the code above in your browser using DataLab