View source: R/print_confint.R
| print_confint | R Documentation |
Creates a nice and convenient output for tables and graphs to report estimates with their corresponding confidence intervals, e.g. 1.2 (95
print_confint( df, new_col, estimate, lcl, ucl, digits = 1, to = " - ", unit = "" )
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 "". |
Character object
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 ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.