A function to compute the majority vote (some would say plurality) label in a vector of labels, breaking ties at random.
A vector of values, either numerical or not.
A list with the following components:
A table of votes for each unique value of
An integer specifying which unique value of
x corresponds to the majority vote.
A string specifying the majority vote label.
x <- c("A", "C", "A", "B", "C", "B", "A") majorityVote(x)#> $table #> x #> A B C #> 3 2 2 #> #> $ind #>  1 #> #> $majority #>  "A" #>