[R] Histogram

Rui Barradas ruipbarradas at sapo.pt
Thu Jul 5 21:39:56 CEST 2012


Hello,

Try the following.

x <- rnorm(1000, mean=2, sd=2)
p <- seq(0, 1, by=1/20)
quant <- quantile(x, probs=p)
hist(x, breaks=quant)


The method is absolutely general, that's why I've separated the several 
steps, to make it clear.

Hope this helps,

Rui Barradas

Em 05-07-2012 20:29, Jim Silverton escreveu:
> I have a column of 1000 datapoints from the normal distribution with mean 2
> and variance 4. How can I get a histogram of these observations with 20
> bins with each bin having 50 observations?
>



More information about the R-help mailing list