Description Usage Arguments Value Author(s) See Also Examples
The Circle hull model predicts that a species is present at sites inside the smallest circle that can contain a set of training points, and absent outside that circle.
1 | circleHull(p, ...)
|
p |
point locations (presence). Two column matrix, data.frame or SpatialPoints* object |
... |
Additional arguments. See details |
An object of class 'CircleHull' (inherits from DistModel-class
)
Robert J. Hijmans
circles, convHull, rectHull, predict
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | r <- raster(system.file("external/rlogo.grd", package="raster"))
#presence data
pts <- matrix(c(17, 42, 85, 70, 19, 53, 26, 84, 84, 46, 48, 85, 4, 95, 48, 54, 66,
74, 50, 48, 28, 73, 38, 56, 43, 29, 63, 22, 46, 45, 7, 60, 46, 34, 14, 51, 70, 31, 39, 26), ncol=2)
train <- pts[1:12, ]
test <- pts[13:20, ]
ch <- circleHull(train)
predict(ch, test)
plot(r)
plot(ch, border='red', lwd=2, add=TRUE)
points(train, col='red', pch=20, cex=2)
points(test, col='black', pch=20, cex=2)
pr <- predict(ch, r, progress='')
plot(pr)
points(test, col='black', pch=20, cex=2)
points(train, col='red', pch=20, cex=2)
# to get the polygons:
p <- polygons(ch)
p
|
Loading required package: raster
Loading required package: sp
Loading required namespace: rgeos
Failed with error: 'there is no package called 'rgeos''
In addition: Warning messages:
1: In couldBeLonLat(...) : CRS is NA. Assuming it is longitude/latitude
2: In .local(x, ...) : crs unknown, assuming lonlat
Warning message:
In .local(x, ...) :
Cannot dissolve because the rgeos package is not available
[1] 0 0 0 0 0 0 0 0
class : SpatialPolygonsDataFrame
features : 1
extent : 52.00895, 52.00986, 41.85467, 41.85535 (xmin, xmax, ymin, ymax)
coord. ref. : NA
variables : 3
names : x, y, r
value : 52.0094064527187, 41.8550112535059, 37.6512931944219
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.