[R] confused about histograms

Jay Pfaffman pfaffman at relaxpc.com
Thu Jul 17 23:32:16 CEST 2003


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
like 

   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).

Thanks.

-- 
Jay Pfaffman                           pfaffman at relaxpc.com
+1-415-821-7507 (H)                    +1-415-812-5047 (M)




More information about the R-help mailing list