distmode: Compute the mode of a distribution

distmodeR Documentation

Compute the mode of a distribution

Description

Computes the mode (and “antimode”) of a distribution. It is not clear whether this is a generally useful statistic, but bedtools defined it, so we did for completeness.

Usage

distmode(x, anti = FALSE)

Arguments

x

The vector for which the mode is computed.

anti

Whether to return the value with the least representation, instead of the highest.

Details

There are methods for List subclasses and ordinary vectors/factors. The List methods are useful for aggregation.

Value

The value that is the most (or least) prevalent in the x.

Author(s)

Michael Lawrence

See Also

Not to be confused with the data mode of a vector.

bedtools_map for an example in the context of aggregation.

Examples

distmode(c(1L, 2L, 1L))

lawremi/HelloRanges documentation built on April 20, 2022, 5:40 p.m.