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

From: Rau, Roland <Rau_at_demogr.mpg.de>
Date: Tue 27 Sep 2005 - 23:54:51 EST

 

> > >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?
Best,
Roland

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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Sep 28 00:05:42 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:46:59 EST