1 | convolMoran(r_pop)
|
r_pop |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (r_pop)
{
meanPop = cellStats(r_pop, sum)/ncell(r_pop)
w = spatialWeights(nrow(r_pop) - 1, ncol(r_pop) - 1)
return(ncell(r_pop) * cellStats(focal(r_pop - meanPop, w,
sum, pad = TRUE, padValue = 0) * (r_pop - meanPop), sum)/cellStats((r_pop -
meanPop) * (r_pop - meanPop), sum)/cellStats(focal(raster(matrix(data = rep(1,
ncell(r_pop)), nrow = nrow(r_pop))), w, sum, pad = TRUE,
padValue = 0), sum))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.