Make a table of several summary statistics with proper formatting.

summary_table(
  mean,
  var,
  quant,
  ic95 = NULL,
  prop0 = NULL,
  prop1 = NULL,
  label,
  digits = 2,
  ...
)

Arguments

mean

Real.

var

Real.

quant

Named numeric vector. Names must be of the form "xx numeric xx. As from the output of the function quantile.

ic95

Numeric vector.

prop0

Real.

prop1

Real.

label

Character. Name of the summarised variable.

digits

Integer. Number of decimal places to be used.

...

Passed to knitr::kable().

Value

A knitr_kable object.

Details

The table includes the mean, variance and standard deviation, a vector of 3 quantiles at 0.05, 0.50 and 0.95, a 95 numeric value to be interpreted as a proportion above 0 and 1. All values are rounded to the specified number of decimal places.

Examples

summary_table(mean = 1, var = 1, quant = quantile(1:10, 0:4/4), ic95 = 4:5,
prop1 = .6, label = "test")
#> 
#> 
#> |Summary |test   |
#> |:-------|:------|
#> |Mean    |1      |
#> |Var     |1      |
#> |S.Dev   |1      |
#> |Min.    |1      |
#> |Q25     |3.25   |
#> |Q50     |5.5    |
#> |Q75     |7.75   |
#> |Max.    |10     |
#> |IC95    |(4, 5) |
#> |Prop>1  |60%    |