Exact number of bins in Histogram in R

后端 未结 5 1057
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:03

    The integer specified as argument for nclass is used as a suggestion:

    the number is a suggestion only

    An alternative solution is to cut your vector into a specified number of groups and plot the result:

    plot(cut(data, breaks = 4))
    

    enter image description here

提交回复
热议问题