geosplit Split geographic data into a training set and a test set All the points within inner.radius of a center point will be in the test set. Everything more than outer.radius away will be in the training set. radii are in meters
1 | geosplit(locations, centers, inner.radius, outer.radius)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | locations = cbind(
longitude = runif(100, min = 80, max = 120),
latitude = runif(100, min = 30, max = 80)
)
locations = cbind(
longitude = runif(2000, min = 80, max = 110),
latitude = runif(2000, min = 30, max = 50)
)
centers = geosphere::regularCoordinates(16)
split = geosplit(locations, centers, inner.radius = 100000, outer.radius = 200000)
colors = split$in.train + 3 * split$in.test
plot(
locations[split$in.train|split$in.test, ],
col = colors[split$in.train|split$in.test],
pch = 16,
cex = .8
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.