calculate_spatial_autocorrelation: calculate_spatial_autocorrelation

View source: R/calculate_spatial_autocorrelation.R

calculate_spatial_autocorrelationR Documentation

calculate_spatial_autocorrelation

Description

Takes the result of grid_metrics (a RasterLayer object) and calculate its spatial autocorrelation.

Usage

calculate_spatial_autocorrelation(raster_obj, metric = "globalmoran", d = NULL)

Arguments

raster_obj

Raster object in the form of the output of grid_metrics.

metric

String. The method for calculating spatial autocorrelation. Choose from "globalmoran" and "GearyC".

d

Numeric. Upper bound local distance. The argument 'd2' from function moran. Default is NULL and the distance will be calculated automatically from the number of splits and the extent of the grid image.

Value

A number is returned

Examples

grid <- grid_metrics(SPIAT::defined_image, FUN = calculate_entropy, 
n_split = 5, cell_types_of_interest=c("Tumour","Immune3"), 
feature_colname = "Cell.Type")
calculate_spatial_autocorrelation(grid, metric = "globalmoran")

TrigosTeam/SPIAT documentation built on Nov. 6, 2023, 3:50 p.m.