xs <- seq(floor(min(fheight)),ceiling(max(fheight)),0.01)
plot(xs, ecdf(fheight)(xs),type = "l", xlab = "height in inches",ylab = "F(x)")
What is the purpose of (xs)
in ecdf(fheight)(xs)
xs <- seq(floor(min(fheight)),ceiling(max(fheight)),0.01)
plot(xs, ecdf(fheight)(xs),type = "l", xlab = "height in inches",ylab = "F(x)")
What is the purpose of (xs)
in ecdf(fheight)(xs)
ecdf(fheight)
returns a function. Yes, it's a bit odd having a function that takes arguments to return another function.
xs
are the arguments to the resulting function.
So ecdf(fheight)(xs)
will return the values of the cumulative density function ecdf(fheight)
at the values of xs
.
From the R help available from ?ecdf
you can see this:
Value
For
ecdf
, a function of class "ecdf
"