Re: [R] calculating the mode in R...

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/03/11 10:59, Tal Galili wrote: > Hello Rainer and Fernando, > > Actually, I think this function should involve the which.max (not max): Right - was not awarw of which.max - I would have used which(max(...)) - which.max is much more elegant. T

Re: [R] calculating the mode in R...

2011-03-30 Thread Tal Galili
Hello Rainer and Fernando, Actually, I think this function should involve the which.max (not max): Here is a tiny function to perform this (with smarter handeling of multiple modes and giving proper warning in such cases) The.mode <- function(x, show_all_modes = F) { x_freq <- table(x) mode_loc

Re: [R] calculating the mode in R...

2011-03-30 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30/03/11 02:47, Fernando Marmolejo Ramos wrote: > Dear R users > > I?m aware that the package ?modest? is useful to find the mode in an array. > > However, I?d like to know if someone has translated the ?mode? function > built-in > in MATLAB into