findMode: Find the Mode

Description Usage Arguments Value Examples

View source: R/utility_functions.R

Description

This function determines the mode for a vector.

Usage

1
findMode(x, discrete = F, ...)

Arguments

x

a vector (can be numeric or a set of strings).

discrete

a logical value; if true, an empirical estimate of the probability mass function is used to determine the mode. If false, an empirical estimate of the probability density function is used instead.

...

additional options for the density function.

Value

Returns the estimated mode for the vector.

Examples

1
2
3
4
5
6
x = rnorm(100)
findMode(x)
x = rbinom(10,20,.5)
findMode(x,discrete=T)
x = c( 'cat','dog','cat','mouse')
findMode(x,discrete=T)

rettopnivek/utilityf documentation built on March 1, 2021, 7:05 p.m.