[R] Mode?

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Tue Nov 23 09:33:33 CET 2004

Hi Yu,

this has been recently discussed in the list, look at:



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat

----- Original Message ----- 
From: "LONG Yu" <ylong at smu.edu.sg>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, November 23, 2004 9:19 AM
Subject: [R] Mode?

> 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

More information about the R-help mailing list