Learn R Programming

viper (version 1.6.0)

distMode: Mode of continuous distributions

Description

This function computes the mode for continuous distributions

Usage

distMode(x, adj = 1)

Arguments

x
Numeric data vector
adj
Number indicating the adjustment for the kernel bandwidth

Value

Number

Examples

Run this code
data(bcellViper, package="bcellViper")
d1 <- exprs(dset)
mean(d1[, 1])
median(d1[, 1])
distMode(d1[, 1])
plot(density(d1[, 1]))
abline(v=c(mean(d1[, 1]), median(d1[, 1]), distMode(d1[, 1])), col=c("green", "red", "blue"))
legend("topleft", c("Mean", "Median", "Mode"), col=c("green", "red", "blue"), lwd=4)

Run the code above in your browser using DataLab