convolMoran:

Usage Arguments Examples

View source: R/convolMoran.R

Usage

1
convolMoran(r_pop)

Arguments

r_pop

Examples

 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))
  }

JusteRaimbault/r-spatialmorphology documentation built on May 22, 2019, 5:07 p.m.