我希望在 R 项目中绘制一个累积直方图,其中在 Y 轴上报告百分比而不是频率
x <- c(rnorm(100), rnorm(50, mean=2,sd=.5))
h <- hist(x, plot=FALSE, breaks=20)
h$counts <- cumsum(h$counts)
h$density <- cumsum(h$density)
plot(h, freq=TRUE, main="(Cumulative) histogram of x", col="white", border="black")
box()
感谢帮助