print_confint: Creates nice confidence report for tables

View source: R/print_confint.R

print_confintR Documentation

Creates nice confidence report for tables

Description

Creates a nice and convenient output for tables and graphs to report estimates with their corresponding confidence intervals, e.g. 1.2 (95

Usage

print_confint(
  df,
  new_col,
  estimate,
  lcl,
  ucl,
  digits = 1,
  to = " - ",
  unit = ""
)

Arguments

df

Dataframe.

new_col

Name of the new column to create.

estimate

Estimate for which confidence interval was created.

lcl

Lower confidence value.

ucl

Upper confidence value.

digits

Round to digits.

to

Separator used in the brackets.

unit

Unit of estimator to include, default is "".

Value

Character object

Examples

library(dplyr)
mtcars %>%
  summarise(mean = mean(mpg),
            n = n(),
            se = sd(mpg)/sqrt(n),
            lcl = mean - 1.96 * se,
            ucl = mean + 1.96 * se) %>%
            print_confint("mean_ci", estimate = mean, lcl = lcl,
                          ucl = ucl, digits = 2, to = " to ")

bsurial/bernr documentation built on Nov. 7, 2022, 1:41 a.m.