Build a buffer around a set of geographical coordinates and take a random point around the buffer. The function is used to omit the precise location of tricot participants while keeping a close distance to the trial environment.
rmGeoIdentity(longlat, dist = 0.015, nQuadSegs = 2L, seed = NULL, ...)a data.frame or matrix with geographical coordinates long lat
numeric, buffer distance for all longlat
integer, number of segments per quadrant
integer, the seed for random number generation. Leave it
NULL (the default) for data that will be shared. The random
displacement does not depend on the original coordinates, so anyone who
knows the seed can reproduce it and recover the exact locations. Use a
seed only for tests or internal reproducibility, and never publish it
further arguments passed to sf methods
A data frame with the random coordinates long lat within the buffer
if (FALSE) { # interactive()
library("sf")
xy = matrix(c(11.097799, 60.801090,
11.161298, 60.804199,
11.254428, 60.822457),
nrow = 3, ncol = 2, byrow = TRUE)
rmGeoIdentity(xy)
#' the function also handles NAs
xy2 = matrix(c(11.097799, 60.801090,
NA, NA,
11.161298, 60.804199,
11.254428, 60.822457,
11.254428, NA),
nrow = 5, ncol = 2, byrow = TRUE)
rmGeoIdentity(xy2)
}