summarySE | R Documentation |
This function creates summary standard error for plotting error bar in ggplot2
summarySE( data = NULL, measurevar, groupvars = NULL, na.rm = TRUE, conf.interval = 0.95, drop = TRUE )
data |
specify dataframe |
measurevar |
specify measure variables for mean, n, sd, se, ci |
groupvars |
specify grouping variables |
na.rm |
TRUE/FALSE whether to remove missing values or not |
conf.interval |
specify confidence interval |
drop |
TRUE/FALSE specify whether to drop or not |
returns a dataframe with n, mean, sd, ci, se
## Not run: dsummary <- summarySE(iris, measurevar = "Petal.Width", groupvars = c("Species", "Sepal.Length") ) dsummary <- summarySE(iris, measurevar = "Sepal.Length", groupvars = c("Species", "Petal.Width"), F ) ggplot(dsummary, aes(Sepal.Length, Petal.Width)) + geom_point() + geom_errorbar(aes(ymin = Petal.Width - se, ymax = Petal.Width + se), width = .03) + geom_smooth() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.