Using the Musa offer:
pre.ecdf <- ecdf(pre.test)
post.ecdf <- ecdf(post.test)
r <- range(pre.test,post.test)
curve(1-pre.ecdf(x), from=r[1], to=r[2], col="red", xlim=r)
curve(1-post.ecdf(x), from=r[1], to=r[2], col="blue", add=TRUE)

You can set some parameters, such as name, legend, etc.
If you need frequency instead of proportion, then a simple solution would be:
pre.ecdf <- ecdf(pre.test)
post.ecdf <- ecdf(post.test)
rx <- range(pre.test,post.test)
ry <- max(length(pre.test),length(post.test))
curve(length(pre.test)*(1-pre.ecdf(x)), from=rx[1], to=rx[2], col="red", xlim=rx, ylim=c(0,ry))
curve(length(post.test)*(1-post.ecdf(x)), from=rx[1], to=rx[2], col="blue", add=TRUE)

Marek source
share