Hi there,
I am trying to use the randomPoints function within the dismo package to select random points with a raster stack (9 layers) as a mask. The documentation for randomPoints says that "The points are sampled (without replacement) from the cells that are not 'NA' in raster 'mask'," and it claims that either a Raster Layer or a Raster Stack object can be passed to the `mask` argument.
However, I am finding that while passing a Raster Stack object works for selecting the points, some NA values turn up in layers of the raster stack other than the first layer, which I guess is the one that the function is using as a mask.
Does anyone have any idea how I can select random points such that any cells that are NA in any layer of the raster stack are excluded? That is, select points such that they have valid values across all layers in the stack?
I posted this
as a question to stack exchange, if anyone is interested in seeing some more details of my code. Also happy to provide additional information.
Thanks for any ideas you might have.