majorityVote | R Documentation |
A function to compute the majority vote (some would say plurality) label in a vector of labels, breaking ties at random.
majorityVote(x)
x |
A vector of values, either numerical or not. |
A list with the following components:
table |
A table of votes for each unique value of |
ind |
An integer specifying which unique value of |
majority |
A string specifying the majority vote label. |
L. Scrucca
x <- c("A", "C", "A", "B", "C", "B", "A")
majorityVote(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.