relative.position | R Documentation |
relative.position
and relative.rank
are used with focal.function()
to determine the relative value of a grid cell compared to its surroundings, either on a metric scale or based on ranks.
relative.position(x) relative.rank(x, ties.method = "average")
x |
a square matrix with the grid data from the moving window, possibly containing |
ties.method |
see |
If x
is provided, a numeric value in the interval [0,1] is returned.
If x
is missing, a character vector of same length giving suggested variable (or file) names, here "relpos"
and "relrank"
, respectively. See focal.function()
for details.
focal.function()
, rank()
, centervalue()
m = matrix( round(runif(9,1,10)), ncol=3 ) print(m) relative.position(m) relative.rank(m) ## Not run: focal.function("dem",fun=relative.rank,radius=5) focal.function("dem",fun=relative.position,radius=5) relrank = as.vector(read.ascii.grid("relrank")$data) relpos = as.vector(read.ascii.grid("relpos")$data) plot(relpos,relrank,pch=".") cor(relpos,relrank,use="complete.obs",method="pearson") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.