Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

majorityVote

Majority vote


Description

A function to compute the majority vote (some would say plurality) label in a vector of labels, breaking ties at random.

Usage

majorityVote(x)

Arguments

x

A vector of values, either numerical or not.

Value

A list with the following components:

table

A table of votes for each unique value of x.

ind

An integer specifying which unique value of x corresponds to the majority vote.

majority

A string specifying the majority vote label.

Author(s)

L. Scrucca

Examples

x <- c("A", "C", "A", "B", "C", "B", "A")
majorityVote(x)

mclust

Gaussian Mixture Modelling for Model-Based Clustering, Classification, and Density Estimation

v5.4.10
GPL (>= 2)
Authors
Chris Fraley [aut], Adrian E. Raftery [aut] (<https://orcid.org/0000-0002-6589-301X>), Luca Scrucca [aut, cre] (<https://orcid.org/0000-0003-3826-0484>), Thomas Brendan Murphy [ctb] (<https://orcid.org/0000-0002-5668-7046>), Michael Fop [ctb] (<https://orcid.org/0000-0003-3936-2757>)
Initial release
2022-05-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.