How do you use hist to plot relative frequencies in R?

前端 未结 5 2020
抹茶落季
抹茶落季 2020-12-31 07:13

How do you use hist() to plot relative frequencies in R?

If I do the following, I will get a density plot, but I want a relative frequency plot:

a &l         


        
5条回答
  •  甜味超标
    2020-12-31 07:24

    histo<-hist(yourvariable)
    barplot(histo$counts/n,col="white",space=0)->bp   # n=length(yourvariable)
    axis(1,at=c(bp),labels=histo$mids)
    title(ylab="Relative Frequency",xlab="Your Variable Name")
    

提交回复
热议问题