I want to compute mode of the following distribution in R. But i think my procedure is not correct to compute it . f <- function(x)(3/7)*x^2 #1<x<2 x=seq(1,2,length=5000) y = f(x) d = data.frame(x,y) d$x[d$y==max(d$y)]