[R] Plotting Binned Data
Gundala Viswanath
gundalav at gmail.com
Wed Feb 18 04:59:33 CET 2009
Dear all,
I have a binned data that looks like this:
> dat
(-1,9] (9,19] (19,29] (29,39] (39,49] (49,59] (59,69] (69,79]
10063374 79 16 4 3 4 4 3
(79,89] (89,99]
6 2
I tried to plot a histogram overlayed with curve.
With the following snippet:
library(lattice)
pdf("myfile.pdf")
hist(dat)
lines(dat,col="red")
dev.off()
__ END__
However the number of bins it plot is not the same
with "dat" (i.e. 10 bins). It only gives 6 bins.
The actual output can be seen in this URL
http://docs.google.com/Doc?id=dcvdrfrh_5cm5qkchw
How can I fix the code so that it gives a exact plot
to "dat" above, with same number of bins and its
respective frequency?
- Gundala Viswanath
Jakarta - Indonesia
More information about the R-help
mailing list