You can still use hist, just provide your own breaks: mydata <- sample(1:10, 100, TRUE, 10:1) br <- c( 0.5:4.5, 10.5 ) hist(mydata, breaks=br, xaxt='n') axis(1, at= c(1:4, mean(5:10)), c( 1:4, '5-10')) box(bty='l')
hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of phoebe kong > Sent: Wednesday, February 11, 2009 11:11 AM > To: r-help > Subject: [R] bar plot/ histogram > > Hi all, > > I would like to construct plot of the distribution of N, where N range > from 1 to 10. I couldn't just use the hist(), as I want the categories > for the bars are: 1, 2, 3, 4, >=5. So this will be a bar plot with 5 > bars, and the height of the bar will be the frequency of N. (eg bar#1 > will be the frequency of N=1, bar #2 will be frequency of N=2, and > bar#5 will be the frequency of N>=5). > > Thanks in advance for your help! > > SY > > ______________________________________________ > 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. ______________________________________________ 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.