#' Calculate Confidence Interval
#' @description # Calculates Confidence Interval of Variable.
#' @export
ci_text <- function(data, var, cond, item, m, se, sd, n){
if(missing(m)) {
m <-
filter_at(data, vars(var), any_vars(. == cond)) %>%
.[, item] %>%
mean() %>%
round(2)
}
if(missing(se) & missing(var)) {
se <- sd / sqrt(n)
}
if(missing(se)) {
se <-
filter_at(data, vars(var), any_vars(. == cond)) %>%
.[, item] %>%
std_err() %>%
round(2)
}
ci <- paste0(m
, ", 95% CI [",
my_round(m - (se * 1.96), 2),
", ",
my_round(m + (se * 1.96), 2),
"]"
)
ci
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.