[R] confused about histograms
tplate at blackmesacapital.com
Thu Jul 17 23:50:32 CEST 2003
> hist(sample(0:3, 10, T), breaks=(0:4)-0.5)
At Thursday 02:32 PM 7/17/2003 -0700, Jay Pfaffman wrote:
>I've got a data set with integer codes from 0--3. I'd like a
>histogram with a single bar for 0, 1, 2 and 3. I'd like each of the 4
>bars centered over a label.
> hist(mydata, breaks=4, main="Simulation")
>gives me three bars. The best I've been able to do is do something
> print(hist((wexp), breaks=25, main="Simulation"))
>This gives me something close to what I want, but seems like a silly
>way to do it. I'm about to give up and have someone do it in Excel
>(which peeves me to no end).
>To further complicate matters, one data set has no items in the zero
>cell. I'd like that graph to look like the others (using my stupid
>hack above it has bars that are a different width).
>Jay Pfaffman pfaffman at relaxpc.com
>+1-415-821-7507 (H) +1-415-812-5047 (M)
>R-help at stat.math.ethz.ch mailing list
More information about the R-help