modalValue: Computes modal value of given vector.

Description Usage Arguments Value

View source: R/modalValue.R

Description

Base R does not offer a convenient method to compute the most frequent value of a given vector. modalValue fills this gap.

Usage

1
modalValue(x, type = "unique", na.rm = TRUE)

Arguments

x

[list]
List or vector of values.

type

[character(1)]
The type parameter indicates how to operate in the multimodal case. The default value is unique, i.e., you get the unique modal value or NA, if such does not exist. Alternatively all returns all modal values.

na.rm

[logical(1)]
Logical value indicating how do deal with NA-values. TRUE, the default value, makes the functions get rid of NAs. Otherwise they are treated as a regular value.

Value

[vector] Vector of most frequent values or NA.


jakobbossek/JBmisc documentation built on May 18, 2019, 9:08 a.m.