Learn R Programming

valueprhr (version 0.1.0)

calculate_mode: Calculate Mode Using Kernel Density Estimation

Description

Estimates the mode of a numeric vector using kernel density estimation. Falls back to median if density estimation fails.

Usage

calculate_mode(x)

Value

A single numeric value representing the estimated mode.

Arguments

x

A numeric vector.

Examples

Run this code
set.seed(123)
x <- rnorm(100, mean = 5, sd = 1)
calculate_mode(x)

Run the code above in your browser using DataLab