ci_mean: Compute Confidence Intervals ready to be ggplot plotted

Usage Arguments Examples

View source: R/ci_mean.R

Usage

1

Arguments

x

Must be a dataframe with at least two variables.

normal

Default is Student Distribution. Normal = T for a Normal Distribution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
x = mtcars [,c('mpg', 'disp', 'hp')]
# or even the entire dataset #
x = mtcars

ci_mean(x, normal = F)

# barplot with CI #
library(dplyr)
library(ggplot2)
library(ggthemes)

xyz = ci_mean(x, normal = F)

ggplot(xyz, aes(reorder(variable, desc(mean)), mean, fill = variable)) +
geom_bar(stat = 'identity') + theme_tufte() +
xlab('') +
geom_errorbar(aes(ymin=low, ymax=high), width=.1, colour = 'black') +
geom_rangeframe(show.legend = F) +
geom_text(aes(label = paste(round(mean), 'min', sep = '')), size = 5, colour = 'gray77', vjust = -1, position=position_dodge(width=0.9)) +
scale_fill_calc(guide = F)

giacomovagni/TimeUseR documentation built on May 17, 2019, 4:18 a.m.