R/calculate_percentage_of_grids.R
calculate_percentage_of_grids.Rd
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.
calculate_percentage_of_grids(raster_obj, threshold, above)
Raster object in the form of the output of
grid_metrics
.
Numeric. The threshold for defining the pattern.
Boolean. Indicating whether the pattern is above (TRUE) or below (FALSE) the threshold.
A number is returned
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)
#> [1] 96