How can I fit a generic curve to an histogram in R?
For instance, in the example: Fitting a density curve to a histogram in R it's shown how to use ggplot density estimate, but I want to fit any kind of curve (to be more specific in this case I want to fit a power law, but it could be any other one, like x^2).
How do I fit that to the data:
hdat <- hist(c(rep(65, times=5), rep(25, times=5), rep(35, times=10), rep(45, times=4)))