Mode?
LONG Yu wrote:
Dear all, I want to find out the mode for a data set, anyone knows how to do it in R? I tried the codes below, but it seems too long: tt<-table(data1) #get the frequency tables of data1 oo<-order(tt); #get the order of frequencies len<-length(tt) #the length of the tables mm<-oo[len]; #the last number of oo is the position tt[mm] #we can get the mode Thank you everybody first! Regards, Long Yu
______________________________________________ R-help at 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
See ?which.max Uwe Ligges