Creating a histogram using aggregated data

前端 未结 1 345
醉话见心
醉话见心 2020-12-21 09:59

Embarrassingly simple question...

I\'m new to R and I can\'t seem to wrap my head around this for some reason. I have a CSV file which looks something like this:

相关标签:
1条回答
  • 2020-12-21 10:59

    Because the hist function does the counting of items in each bin, you need to 'explode' your 'already counted' data, for example by using rep. Then you can use hist on the resulting vector.

    with(df, hist(rep(x = Bin, times = Number)))
    
    0 讨论(0)
提交回复
热议问题