Force R to plot histogram as probability (relative frequency)

前端 未结 5 2031
面向向阳花
面向向阳花 2021-01-31 05:40

I am having trouble plotting a histogram as a pdf (probability)

I want the sum of all the pieces to equal an area of one so it\'s easier to compare across datasets. For

5条回答
  •  孤独总比滥情好
    2021-01-31 06:09

    To answer the request to plot probabilities rather than densities:

    h <- hist(vec, breaks = 100, plot=FALSE)
    h$counts=h$counts/sum(h$counts)
    plot(h)
    

提交回复
热议问题