reportCI: Report CI

View source: R/helpers.R

reportCIR Documentation

Report CI

Description

A simple function for formatting and printing estimates with their confidence intervals or similar statistics that follow a "X [Y, Z]" format. Takes a numeric vector or matrix with three elements / columns: estimate, lower quantile from a CI, and upper quantile from a CI. For each row, it prints the result as "estimate [CI]".

Usage

reportCI(n, digits = 2, suffix = NULL)

Arguments

n

numeric vector or matrix-like object

digits

number of decimal points to preserve

suffix

a string to print between the first value and the values in []

Value

Does not return anything, just prints the estimate and CI.

Examples

n = rnorm(100)
reportCI(quantile(n, probs = c(.5, .025, .975)))

a = data.frame(fit = c(3, 5, 7),
               lwr = c(1, 4, 6.5),
               upr = c(5, 6, 7.1))
reportCI(a, 1)
reportCI(a, 1, ' cm')
reportCI(a, 1, '%, 95% CI')

soundgen documentation built on Sept. 20, 2026, 5:07 p.m.