File: majorityVote.Rd

package info (click to toggle)
r-cran-mclust 6.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,540 kB
  • sloc: fortran: 13,298; ansic: 201; sh: 4; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
\name{majorityVote}
\alias{majorityVote}

\title{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{
  \item{x}{A vector of values, either numerical or not.}
}

\value{A list with the following components:
  \item{table}{A table of votes for each unique value of \code{x}.}
  \item{ind}{An integer specifying which unique value of \code{x} corresponds to the majority vote.}
  \item{majority}{A string specifying the majority vote label.}
}

%\seealso{}
\author{L. Scrucca}

\examples{
x <- c("A", "C", "A", "B", "C", "B", "A")
majorityVote(x)
}