computeMode: Compute statistical mode of a vector (value that occurs most...

Description Usage Arguments Value Examples

View source: R/computeMode.R

Description

Works for integer, numeric, factor and character vectors. The implementation is currently not extremely efficient.

Usage

1
computeMode(x, ties.method = "random", na.rm = TRUE)

Arguments

x

[vector]
Factor, character, integer, numeric or logical vector.

ties.method

[character(1)]
“first”, “random”, “last”: Decide which value to take in case of ties. Default is “random”.

na.rm

[logical(1)]
If TRUE, missing values in the data removed. if FALSE, they are used as a separate level and this level could therefore be returned as the most frequent one. Default is TRUE.

Value

Modal value of length 1, data type depends on data type of x.

Examples

1
computeMode(c(1,2,3,3))

berndbischl/BBmisc documentation built on Nov. 29, 2017, 5:10 a.m.