[R] hist function: freq=FALSE for standardised histograms

2006-04-05 Thread Alex Davies
Dear All, I am a undergraduate using R for the first time. It seems like an excellent program and one that I look forward to using a lot over the next few years, but I have hit a very basic problem that I can't solve. I want to produce a standardised histogram, i.e. one where the area under the

Re: [R] hist function: freq=FALSE for standardised histograms

2006-04-05 Thread Marco Geraci
Hi, how did you evaluate the total area? Here is a simple example ### set.seed(100) x - rnorm(100) x.h - hist(x, freq=F, plot=F) x.h $breaks [1] -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 $counts [1] 3 4 9 14 22 20 13 7 5 2 1 $intensities [1] 0.0599 0.0800

Re: [R] hist function: freq=FALSE for standardised histograms

2006-04-05 Thread Alex Davies
Dear Marco, I compared the maximum values with what I was expecting based on a calculation in Excel however I've just run the set of commands to calculate the area: out - hist(StockReturns, probability=TRUE, plot=FALSE) out sum(diff(out$breaks) * out$intensities) And it seems to have worked