[R] How to get mode (the most frequent value in distribution)?
Ales Ziberna
ales.ziberna at guest.arnes.si
Sat Nov 13 12:15:54 CET 2004
Maybe a litle simpler solution:
x<-rnorm(50)
den<-density(x) #see ?density for more details
den$x[which(den$y==max(den$y))]
Hope it helps,
Ales Ziberna
----- Original Message -----
From: "Gregor GORJANC" <gregor.gorjanc at bfro.uni-lj.si>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, November 12, 2004 6:38 PM
Subject: Re: [R] How to get mode (the most frequent value in distribution)?
Thanks to all!
It appears that mode calculation is not easy or simple at all. I
understand that it is problematic when you have continous distribution,
but there should still be some general function, as for median, mean, ...
--
Lep pozdrav / With regards,
Gregor GORJANC
---------------------------------------------------------------
University of Ljubljana
Biotechnical Faculty URI: http://www.bfro.uni-lj.si
Zootechnical Department mail: gregor.gorjanc <at> bfro.uni-lj.si
Groblje 3 tel: +386 (0)1 72 17 861
SI-1230 Domzale fax: +386 (0)1 72 41 005
Slovenia
______________________________________________
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