How to create a column with the sum ggplot

I'm not sure what you mean by 'test' -- could you describe the specific calculations you were hoping to make?

I'm so sorry... I was very busy but I found a solution with an extra line sum(x[[col]])

data_summary_session2 <- function(data = dfdata_session2, varname = Nombre.de.contacts, groupnames = c(Odeur, Type.de.test)){
  require(plyr)
  summary_func <- function(x, col){
    c(mean = mean(x[[col]], na.rm=TRUE),
      sd = sd(x[[col]], na.rm=TRUE),
      sum = sum(x[[col]], na.rm = TRUE))
  }
  data_sum<-ddply(data, groupnames, .fun=summary_func,
                  varname)
  data_sum <- rename(data_sum, c("mean" = varname))
  return(data_sum)
}

Thanks a lot for your help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.