I\'m having trouble making a histogram in R. The problem is that I tell it to make 5 bins but it makes 4 and I tell to make 5 and it makes 8 of them.
data &l
Building on the answer from Rob Hyndman:
Maybe a more generic solution would be to make the breaks considering the minimun and maximun values of the data, and the number of breaks = number_of_bins+1.
hist(data,breaks=seq(min(data),max(data),l=number_of_bins+1),
freq=FALSE,col="orange",
main="Histogram",xlab="x",ylab="f(x)",yaxs="i",xaxs="i")