Constructs a confidence intervals from upper and lower bounds, placing them in between square brackets

fmt_ci(lower, upper, digits = 2, drop_0 = FALSE)

Arguments

lower

Lower bound(s) of confidence interval(s). Numeric, or a vector of numbers

upper

Lower bound(s) of confidence interval(s). Numeric, or a vector of numbers

digits

Number of significant digits, defaults to 2

drop_0

Logical. Should leading 0 be dropped, e.g., when reporting correlation coefficients. Note that this only works when all values are between -1 and 1 (inclusive)

Examples

fmt_ci(1.23, 2.68)
#> [1] "[1.23, 2.68]"
fmt_ci(c(0.12, 0.45), c(0.34, 0.67), drop_0 = TRUE)
#> [1] "[.12, .34]" "[.45, .67]"