Mode: Statistical Mode

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

Description

This function computes the statistical mode of given data.

Usage

1
Mode(x)

Arguments

x

a numeric or character vector.

Value

A list containing the following components:

Values

of statistical mode(s) found, in the order they appear in x

Frequency

number of times the mode(s) appear in x

NA values are also considered.

Author(s)

Ian Castillo.

References

Kotz, S., Balakrishnan, N., Read, C.B, Vidakovic, B., Johnson, N.L. (2006) Encyclopedia of Statistical Sciences. Wiley, New Jersey.

See Also

cummode

Examples

1
2
3
4
5
6
7
Mode(c(rep(1, 2), rep(12, 5), rep(44, 3), rep(8, 5), 55))

Mode(c(rep(1, 2), rep(12, 5), rep(44, 3), rep(8, 5), rep(NA, 7), 55))

Mode(runif(5))

Mode(c(rep("a", 2), rep("b", 5), rep("d", 3), rep("e", 5), rep(NA, 5)))

Example output

$Values
[1] 12  8

$Frequency
[1] 5

$Values
[1] NA

$Frequency
[1] 7

$Values
[1] 0.6831134 0.6663457 0.9113643 0.2526526 0.6735869

$Frequency
[1] 1

$Values
[1] "b" "e" NA 

$Frequency
[1] 5

cumstats documentation built on May 2, 2019, 3:04 a.m.