You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When na.rm=FALSE (the default), spatSample often returns a smaller sample than requested, even if there are more than enough pixels in the raster. This doesn't seem to happen when na.rm=TRUE:
r <- rast(system.file("ex/elev.tif", package="terra"))
r <- aggregate(r, 5)
ncell((r)) # 342
sum(!is.na(values(r))) # 152
set.seed(1)
spatSample(r, 150) # Warning message: [spatSample] fewer values returned than requested
spatSample(r, 150, na.rm = TRUE) # OK
The text was updated successfully, but these errors were encountered:
When
na.rm=FALSE
(the default),spatSample
often returns a smaller sample than requested, even if there are more than enough pixels in the raster. This doesn't seem to happen whenna.rm=TRUE
:The text was updated successfully, but these errors were encountered: