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

View source: R/computeMode.R

computeModeR Documentation

Compute statistical mode of a vector (value that occurs most frequently).

Description

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

Usage

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

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

BBmisc documentation built on Sept. 29, 2022, 5:12 p.m.

Related to computeMode in BBmisc...