No, this is not quite right:
which.max
--
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
R search page: http://finzi.psych.upenn.edu/
You need to be more careful
1. For a continuous distribution, the mode is ** not ** the most frequent
value (this has no meaning) -- it is the maximum of the density function. So
you must fit a density function and then estimate the mode, perhaps by using
which.max() on a discretization of the fitted density. Or, if you have the
fitted density in closed form (and it is unimodal) you can use calculus.
2. For a discrete distribution, which could be the sample empirical
distribution,use which.max(table()).
-- Bert Gunter