[R] How to plot Histogram with frequence overlaid by distribution curve

Rolf Turner rolf at math.unb.ca
Mon Mar 1 21:48:30 CET 2004


Spencer Graves wrote:

> ?truehist in library(MASS)? 
> 
> library(MASS)
> truehist(samp)
> x <- seq(-8.5, -6, length=51)
> lines(x, dnorm(x, mean(samp), sqrt(var(samp))))

> This just worked for me in both S-Plus 6.2 and R 1.8.1.

	What's wrong with ``hist(samp,prob=TRUE)''?

> hope this helps.  spencer graves

	I wasn't aware that I was in need of any help.  I merely made
	a comment on a wrong-headed question that was addressed to
	this list.


				cheers,

					Rolf Turner




More information about the R-help mailing list