[R] mode of a data set

Adelchi Azzalini azzalini at stat.unipd.it
Mon Jun 23 18:01:07 CEST 2003


On Monday 23 June 2003 17:50, Erin Hodgess wrote:
> Dear R People:
>
> Is there a function to find the mode of a data set, please?
>
> This is the mode as in the value(s) which occur most often.
>

 x[rev(order(table(x)))[1]]

is this what you want?

regards
Adelchi Azzalini

-- 
Adelchi Azzalini  <azzalini at stat.unipd.it>
Dipart.Scienze Statistiche, Università di Padova, Italia
http://azzalini.stat.unipd.it/




More information about the R-help mailing list