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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html