## create example source location likelihood raster
x <- terra::rast(nrows = 100, ncols = 100,
xmin = 0, xmax = 10,
ymin = 0, ymax = 10)
terra::values(x) <- runif(n = 100)
## identify location of highest likelihood
p_max <- spatial_pmax(data = x)
## show result
print(p_max)
Run the code above in your browser using DataLab