Skip to contents

Global Moran's I on a spatial object

Usage

morie_spatial_moran(x, var, neighbors = NULL)

Arguments

x

A morie_spatial.

var

Name of the attribute variable, or a numeric vector.

neighbors

Optional neighbour matrix (default knn, k = 4).

Value

A list with Moran's I and the expected value under no autocorrelation.

Examples

g <- expand.grid(lon = 1:5, lat = 1:5)
g$v <- g$lon + g$lat
morie_spatial_moran(morie_spatial(g), "v")
#> $I
#> [1] 0.775
#> 
#> $expected
#> [1] -0.04166667
#>