R code used at
VAPMS Selected Applications of Mathematical Statistics, summer semester 2018/2019.
Class 5 (Mar 21 2019)
Example of a function computing mode of a distribution
(Homework 3), procedural "non-R" style:
Mode <- function (v)
{
max <- 0;
for (val in unique (v))
{
count <- length (v[v==val]);
if (count > max)
{
max <- count;
m <- val;
}
else if (count == max)
{
max <- count;
m <- c(m,val);
}
}
return (m);
}
Created: Wed Sep 30 2015
Last modified: Sun Mar 24 08:59:33 CET 2019