On Fri, 12 Nov 2004, Vito Ricci wrote:
> Mode<-function(x){t<-table(x)
> if (is.numeric(x)) as.numeric(names(t)[t == max(t)])
> else (names(t)[t == max(t)])
> }
>
> Any other improvement and suggestion will welcome.
>
which.max is design for finding the maximum, so
names(t)[which.max(t)]
-thomas