On 03/24/2010 04:36 PM, cbarcelo wrote:
Hello, I need to make a histogram with variable x bin ranges. For example my bins are 0-15, 15-25, 25-40 etc. Any suggestions? Thanks!
Hi cbarcelo, You can just do this: x<-sample(0:40,100,TRUE) hist(x,breaks=c(0,15,25,40)) which will produce densities, or: hist(x,breaks=c(0,15,25,40),freq=TRUE) which will display counts, but complain about it, or: barplot(hist(x,breaks=c(0,15,25,40))$counts, names.arg=c("(0-15]","(15-25]","(25-40]")) which may be what you want. Jim ______________________________________________ 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.