Learn R Programming

dismo (version 1.3-16)

CirclesRange: Circles range

Description

The Circles Range model predicts that a species is present at sites within a certain distance from a training point, and absent further away.

Usage

# S4 method for matrix
circles(p, d, lonlat, n=360, r=6378137, dissolve=TRUE, ...)

# S4 method for SpatialPoints circles(p, d, lonlat, n=360, r=6378137, dissolve=TRUE, ...)

Value

An object of class 'CirclesRange' (inherits from DistModel-class)

Arguments

p

point locations (presence). Two column matrix, data.frame or SpatialPoints* object

d

numeric. The radius of each circle in meters. A single number or a vector with elements corresponding to rows in p. If missing the diameter is computed from the mean inter-point distance

lonlat

logical. Are these longitude/latitude data? If missing this is taken from the p if it is a SpatialPoints* object

n

integer. How many vertices in the circle? Default is 360

r

numeric. Radius of the earth. Only relevant for longitude/latitude data. Default is 6378137 m

dissolve

logical. Dissolve overlapping circles. Setting this to FALSE may be useful for plotting overlapping circles

...

additional arguments, none implemented

Author

Robert J. Hijmans

See Also

predict, geoDist, convHull, maxent, domain, mahal, convHull

Examples

Run this code
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, ]
				 
cc <- circles(train, lonlat=FALSE)
predict(cc, test)

plot(r)
plot(cc, border='red', lwd=2, add=TRUE)
points(train, col='red', pch=20, cex=2)
points(test, col='black', pch=20, cex=2)

pr <- predict(cc, r, progress='')
plot(r, legend=FALSE)
plot(pr, add=TRUE, col='blue')
points(test, col='black', pch=20, cex=2)
points(train, col='red', pch=20, cex=2)


# to get the polygons:
p <- polygons(cc)
p

# to compute the Circular Area Range of a species (see Hijmans and Spooner, 2001)
pts <- train*10
ca100 <- polygons(circles(pts, d=100, lonlat=FALSE))
ca150 <- polygons(circles(pts, d=150, lonlat=FALSE))
sum(area(ca150)) / (pi*150^2)
sum(area(ca100)) / (pi*100^2)
par(mfrow=c(1,2))
plot(ca100); points(pts)
plot(ca150); points(pts)



Run the code above in your browser using DataLab