From: Christoph Scherber <Christoph.Scherber_at_uni-jena.de>

Date: Tue 25 Oct 2005 - 00:55:39 EST

serr<-s/sqrt(l)

return(data.frame(list("Mean"=m,"Std.Error"=serr))) }

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Oct 25 01:11:44 2005

Date: Tue 25 Oct 2005 - 00:55:39 EST

Dear R users,

I would like to aggregate a data frame using several functions at once (e.g., mean plus standard error).

How can I make this work using aggregate()? The help file says scalar functions are needed; can anyone help?

Below is the code for my "meanse" function which IŽd like to use like this:

aggregate(dataframe, list(factorA,factoB),meanse)

Thanks for your help!

Christoph

meanse<-function(x,...,na.rm=T){

if(na.rm)

x<-x[!is.na(x)] m<-mean(x) s<-sd(x) l<-length(x)

serr<-s/sqrt(l)

return(data.frame(list("Mean"=m,"Std.Error"=serr))) }

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Oct 25 01:11:44 2005

*
This archive was generated by hypermail 2.1.8
: Tue 25 Oct 2005 - 03:14:40 EST
*