[R] hist(x, ...) with normal distribution curve

Rau, Roland Rau at demogr.mpg.de
Tue Sep 27 15:54:51 CEST 2005

> > >Knut Krueger wrote:
> >  
> >
> >>I am looking for a histogram or box plot with the adding  normal 
> >>distribution  curve
> >>I think that must be possible, but I am not able to find 
> out how to do.
> >>
Since there are various solutions, here is mine:

hist(rnorm(10000), freq=FALSE)
xvals <- seq(-5,5,length=100)
lines(x=xvals, y=dnorm(xvals))

Is this what you are looking for?

This mail has been sent through the MPI for Demographic Rese...{{dropped}}

More information about the R-help mailing list