# create a random distribution
x <- rnorm(n = 1000, mean = 2, sd = 25)
# perform a local regression
loc <- locfit::locfit(~x)
# compute the mode of the locfit object
mode_locfit(locx = loc, xlim = c(min(x), max(x)))
Run the code above in your browser using DataLab