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

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")
#> # A tibble: 2 x 2 #> Group Estimate #> <chr> <chr> #> 1 a 1.32 (1.15, 1.44) #> 2 b 0.80 (0.74, 0.99)