modus: Modus

Description Usage Arguments Value Examples

Description

Calculate the mode of a numeric vector. German name kept to avoid confusion.

Usage

1
modus(x, na.rm = FALSE)

Arguments

x

A vector with numeric data.

na.rm

If TRUE, missing values (NA) will be ignored.

Value

A vector of length 1 of type numeric or character, depending on input.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
x <- c(1, 2, 6, 2, 1, 5, 7, 8, 4, 3, 2, 2, 2)
modus(x)

# Or for nominal data
x <- structure(c(2L, 1L, 2L, 2L, 2L, 1L), .Label = c("Ja", "Nein"), class = "factor")
modus(x)

## End(Not run)

jemus42/qmtut documentation built on May 19, 2019, 4:03 a.m.