majority: Determines majority class

Description Usage Arguments Details Value Author(s) See Also Examples

Description

A function which determines the majority class of a vector (treated as factor).

Usage

1

Arguments

x

a one dimensional vector

Details

This function treats the input vector as a factor and determines which level (class) of the factor is present most often. If two or more levels tie for majority then a random selection is made among the ties.

Value

The factor level which occurs most often in x.

Author(s)

Atina Dunlap Brooks

See Also

factor

Examples

1
2
x <- sample( c("a","b","c","d","e"), 10, replace=TRUE )
majority(x)

Dasonk/knnflex documentation built on May 6, 2019, 1:37 p.m.