nrange: Summarize three columns as N (low, high)

View source: R/nrange.R

nrangeR Documentation

Summarize three columns as N (low, high)

Description

Often useful for summarizing an association metric and it's confidence interval.

Usage

nrange(
  .data,
  n,
  low,
  high,
  accuracy = 0.01,
  name = "Estimate",
  formatter = c("comma", "percent", "number"),
  remove = TRUE,
  big.mark = ","
)

Arguments

.data

A tbl.

n, low, high

Column names to summarize

accuracy

Number to round to, NULL for automatic guess.

name

Name of new column.

formatter

scales function used to format text

remove

If TRUE, remove input columns from output data frame.

big.mark

Character used between every 3 digits to separate thousands.

Value

An object of the same class as .data.

Examples

df <- tibble::tribble(
  ~Group, ~n, ~low, ~high,
  "a", 1.323453, 1.154, 1.44,
  "b", .801, .741, .9891
)

df %>% nrange(n, low, high, formatter = "comma")

overdodactyl/mRclwhip documentation built on June 30, 2023, 6:24 a.m.