Exact number of bins in Histogram in R

后端 未结 5 1068
Happy的楠姐
Happy的楠姐 2020-12-01 08:24

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         


        
5条回答
  •  孤街浪徒
    2020-12-01 09:15

    I like to be quite accurate about my data points:

    hist(data,breaks = seq(min(data),max(data),by=((max(data) - min(data))/(length(data)-1))))
    

    This should automate the process with little manual input.

提交回复
热议问题