Summarizes data, handling within-subjects variables by removing inter-subject variability. It will still work if there are no within-S variables. Gives count, mean, standard deviation, standard error of the mean, and confidence interval (default 95%). If there are within-subject variables, calculate adjusted values using method from Morey (2008).
summarySEwithin(data = NULL, measurevar,
betweenvars = NULL, withinvars = NULL, idvar = NULL,
na.rm = FALSE, conf.interval = 0.95, .drop = TRUE)
a data frame
the name of a column that contains the variable to be summariezed
a vector containing names of columns that are between-subjects variables
a vector containing names of columns that are within-subjects variables
the name of a column that identifies each subject (or matched subjects)
a boolean that indicates whether to ignore NA's
the percent range of the confidence interval (default is 95%)
should combinations of variables that do not appear in the input data be preserved (FALSE) or dropped (TRUE, default)
a data frame with count, mean, standard deviation, standard error of the mean, and confidence interval (default 95%).
http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)