[R] Mode?

francoisromain@free.fr francoisromain at free.fr
Tue Nov 23 12:55:28 CET 2004


Yhe question of finding the mode of a dataset has been discussed previously in
the list not only for categorical data :

search "How can I get the mode" in the search engine of the list.

Hope this helps.

Romain.

Selon Uwe Ligges <ligges at statistik.uni-dortmund.de>:

> 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
>
> ______________________________________________
> 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