On Sun, Jan 1, 2012 at 5:29 AM, peter dalgaard <pda...@gmail.com> wrote: > Exactly. If what you want is a barplot, make a barplot; histograms are for > continuous data. Just remember that you may need to set the levels > explicitly in case of empty groups: barplot(table(factor(x,levels=0:23))). > (This is irrelevant with 100K data samples, but not with 100 of them). > > That being said, the fact that hist() tends to create breakpoints which > coincide with data points due to discretization is arguably a bit of a design > error, but it is age-old and hard to change now. One way out is to use > truehist() from MASS, another is to explicitly set the breaks to intermediate > values, as in hist(x, breaks=seq(-.5, 23.5, 1))
Thanks, everybody. I'll definitely switch to barplot. As for continuous, it's all relative. Even the most continuous dataset at a scale that looks pretty to humans may have gaps between the values when you "zoom in" a lot. Aren ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.