[R] How to get mode in case of discrete or categorial data

Vito Ricci vito_ricci at yahoo.com
Fri Nov 12 14:20:37 CET 2004


Dear all,

in a previuos message was asked  how get the mode of
continous distribution. Now I'm asking if there an R
function to obtain the mode in case of a discrete
distribution or categorial data. The only way is to
use table():

> x<-rep(1:5,100)
> s<-sample(x,40)
> t<-table(s)
> t
s
 1  2  3  4  5 
13 10  5  4  8 

the mode is value=1

Thanks
Cordially
Vito

=====
Diventare costruttori di soluzioni
Became solutions' constructors

"The business of the statistician is to catalyze 
the scientific learning process."  
George E. P. Box


Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml




More information about the R-help mailing list