Skip to contents

Format an estimate and its interval for a table

Usage

fmt_est_ci(est, lo, hi, digits = 1, scale = 100)

Arguments

est, lo, hi

Estimate and interval bounds, on the 0-1 scale by default.

digits

Decimal places.

scale

Multiplier applied before formatting; 100 turns proportions into percentages.

Value

A character vector such as "88.3 (87.4–89.1)" (the bounds are separated by an en dash, not a hyphen), or an em dash where the estimate is missing.

Examples

m <- diagnostic_metrics(tp = 80, fn = 20, fp = 10, tn = 90)
fmt_est_ci(m$sensitivity, m$sensitivity_lo, m$sensitivity_hi)
#> [1] "80.0 (71.1–86.7)"