I was doing my assignment, and I found something strange.

I did this code for question #1.

x <- heights$height[heights$sex=="Male"]

and the next question is like this:

"We will define a function "CDF" like following:

CDF <- function(a) {mean(x<=a)}

Explain why the CDF function is Cumulative Distribution Function."

I get the idea of the cumulative distribution function, but I don't get why function mean() is used there.

For example, CDF(70) equals 0.623..., which is the probability of cumulative distribution at 70. How does mean() function show probability in this function?