#' modified summary function used for ggbarplot
#'
#' @param data http://www.sthda.com/english/wiki/ggplot2-error-bars-quick-start-guide-r-software-and-data-visualization
#'
#' @return summarized matrix with SEM and mean for Barplot
#' @export
#'
#' @examples
data_summary <- function(data, varname, groupnames){
summary_func <- function(x, col){
c(mean = mean(x[[col]], na.rm=TRUE),
SEM = sd(x[[col]]/sqrt(length(x[[col]])), na.rm=TRUE))
}
data_sum<-ddply(data, groupnames, .fun=summary_func,
varname)
data_sum <- plyr::rename(data_sum, c("mean" = "len"))
return(data_sum)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.