calculate_percentage_of_grids: calculate_percentage_of_grids

View source: R/calculate_percentage_of_grids.R

calculate_percentage_of_gridsR Documentation

calculate_percentage_of_grids

Description

Takes the result of grid_metrics (a RasterLayer object) and calculates the percentage of the grid squares whose values are above or below a specified threshold.

Usage

calculate_percentage_of_grids(raster_obj, threshold, above)

Arguments

raster_obj

Raster object in the form of the output of grid_metrics.

threshold

Numeric. The threshold for defining the pattern.

above

Boolean. Indicating whether the pattern is above (TRUE) or below (FALSE) the threshold.

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_percentage_of_grids(grid, threshold = 0.75, above = TRUE)

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