## numeric data
z <- rnorm(50)
FZ <- ecdf(z)
QZ <- quantilefun(FZ)
QZ(0.5) # median value of z
if(interactive()) plot(QZ, xlim=c(0,1), xlab="probability",
ylab="quantile of z")
## image data
Z <- bei.extra$elev
if(require(spatstat.explore)) {
FE <- spatialcdf(Z, normalise=TRUE)
} else {
FE <- ecdf(Z[])
}
QE <- quantilefun(FE)
QE(0.5) # median elevation
if(interactive()) plot(QE, xlim=c(0,1),
xlab="probability", ylab="quantile of elevation")
Run the code above in your browser using DataLab