raster_stats_cell.Rd
Apply fun to Local Neighborhoods
raster_stats_cell( cell_id, im, polys, fun, buffer_radius = 90, plot_masks = TRUE )
cell_id | The ID of the cell to extract a local neighborhood around. |
---|---|
im | The raster object giving the pixel-level information about the sample. |
polys | A spatial data.frame with a column (geometry) giving the spatial geometry of each cell. |
fun | A function that can be applied to a data.frame whose rows are pixels and whose columns give features of those pixels (e.g., immune group). |
buffer_radius | The size of the window around cell_id, to use to subset the raster on which to apply fun. |
plot_masks | If you want to see what the subsets of cells looks like, you can use this. |
result A tibble mapping the cell to statistics calculated by fun.