est_ci: Paste an estimate and CI together

Description Usage Arguments Value Examples

View source: R/formatrs.R

Description

Quickly concatenate an estimate with its confidence intervals. Works with vectors hexor output from broom::tidy().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
est_ci(est, lower = NULL, upper = NULL, var = NULL,
  include_name = FALSE, bound = parenthesis(), divider = comma(),
  descriptor = ci(95), digits = 2)

ci(lvl = 95)

minmax()

iqr()

none()

parenthesis()

brackets()

dash()

comma()

Arguments

est

either a data.frame or a vector of estimates

lower

the lower CI. if NULL, will search for "conf.low"

upper

the upper CI. if NULL, will search for "conf.high"

var

estimate name

include_name

logical. Should the name of the term be included?

bound

bounding symbols around the CI. Default is parentheses.

divider

a divider between the upper and lower CI. Default is a comma.

descriptor

a descriptor of the CI. Default is "95% CI".

digits

the number of digits to round to

lvl

the confidence interval probability

Value

a data.frame or vector.

Examples

1
2
3
4
5
6
7
8
library(broom)
library(dplyr)

x <- tidy(lm(mpg ~ hp, data = mtcars), conf.int = TRUE)
x %>%
  mutate(eci = est_ci(estimate, conf.low, conf.high))

est_ci(x)

malcolmbarrett/mbmisc documentation built on May 17, 2019, 8:16 a.m.