I just added a function "sample.distance" to the development version of spatialEco package. You can install the developemntdevelopment version from GitHub using: devtools::install_github("jeffreyevans/spatialEco")
I included a replacement argument to allow for sampling with or without replacement. I also added a d.max argument that allows for maximum as well as minimum (d) sampling distance. The defaults are no replacement (FALSE) and no maximum sampling distance. The trace argument is to print min/max sample distances for each random samples as well as the number of iterations for distance convergence.
Please note that just because you specify a condition for your data does not mean that it can actually be met. Here is an example using the simple meuse data. The problemdata cannot meet the condition of a 500m minimum sampling distance atfor greater than ~15 points (n for 50% sample is 78). This is obviously dictated by the configuration of the randomization but n should not vary that much. I added error checking for non-convergence and the function will return the subsample on however many samples can be identified using the given conditions.
library(sp)
library(spatialEco)
data(meuse)
coordinates(meuse) <- ~ x+y
p = round( nrow(meuse) * 0.50, 0 )
sub.meuse <- sample.distance(meuse, n = p, d = 500, trace = TRUE)
plot(meuse,pch=19, main="min dist = 500")
points(sub.meuse, pch=19, col="red")
If you end up using this function in your research, please cite the package.