Hi Carolos,

I know that it is not a elegant soluction, but may work. Almost for integer
values. Take care with float values.


modevalue<-function(x)
 {
 x.freq<-data.frame(table(x))
 x.freq.max<-max(x.freq$Freq)
 x.freq.selected<-subset(x.freq, x.freq$Freq==x.freq.max)
 return(c(unlist(x.freq.selected$x)))
 }
x<-sample(x=0:10, size=200, replace=T)
modevalue(x)



On Sat, Sep 6, 2008 at 2:24 PM, Carlos Morales
<[EMAIL PROTECTED]>wrote:

> Hello everyone,
>
>
> I would like to know if there is any function to calculate the mode value,
> or I have to build one to do it.
>
>
> Thanks so much
> Carlos
>
>
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to