I am trying to generate cumulative relative frequency with polygon in R base that look like this:
These are my data (they are different from those of the picture above):
df <- data.frame(foo = c(15, 23, 12, 10, 28, 20, 12, 17, 20,
21, 18, 13, 11, 12, 26, 30, 6, 16,
19, 22, 14, 17, 21, 28, 9, 16, 13,
11, 16))
I can draw a basic histogram using
hist(df$foo, col="pink")
And I can draw a histogram of cumulative absolute frequency with a polygon like this:
# save to object
h <- hist(df$Patienten, plot=FALSE)
# replace with cumulative data
h$counts <- cumsum(h$counts)
### plot
plot(h, col="hotpink")
# add Polygon
lines(c(0, h$mids), c(0,h$counts), col="blue") # add type="s" if you like
But how would I do that with relative and cumulative frequencies, just as the screenshot above shows?
(the screenshot is from https://github.com/asalber/statistics-manual p.20)