Displaying 1 result from an estimated 1 matches for "factob".
Did you mean:
factor
2005 Oct 24
0
aggregating using several functions
...ing 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)))
}