majorityVote: Majority vote

View source: R/impute.R

majorityVoteR Documentation

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 documentation built on Nov. 16, 2023, 5:10 p.m.