buffer_area | R Documentation |
buffer_area helps in creating buffer polygons based on occurrences, masking raster layers, and writing results if needed.
buffer_area(data, longitude, latitude, buffer_distance = 100,
raster_layers = NULL, clip = FALSE, mask = FALSE,
save = FALSE, name = "calib_area_buffer")
data |
data.frame of occurrence records containing at least longitude and latitude columns. |
longitude |
(character) name of the column with longitude data. |
latitude |
(character) name of the column with latitude data. |
buffer_distance |
(numeric) distance in km to be used to create a buffer for the convex hull. Default = 100. |
raster_layers |
optional RasterStack to be used in restricting the resulting SpatialPolygon and in preparing variables for further processing. Default = NULL. |
clip |
(logical) whether or not to clip polygons considering boundaries
of layers in |
mask |
(logical) whether or not to mask the |
save |
(logical) whether or not to write the results in the working directory. Default = FALSE. |
name |
(character) name of a folder to be written with the results if
|
If raster layers are masked, a lits containing a SpatialPolygonDataFrame and a RasterStack of the masked layers.
If raster layers are not masked, a SpatialPolygonDataFrame.
If save
= TRUE, results are written in a folder named as in name
.
# reading data
occurrences <- read.csv(system.file("extdata", "occurrences.csv",
package = "ellipsenm"))
# producing polygons
b_area <- buffer_area(data = occurrences, longitude = "longitude",
latitude = "latitude", buffer_distance = 50)
sp::plot(b_area)
points(occurrences[, 2:3])
# producing polygons and masking layers
vars <- raster::stack(list.files(system.file("extdata", package = "ellipsenm"),
pattern = "bio", full.names = TRUE))
b_area1 <- buffer_area(data = occurrences, longitude = "longitude",
latitude = "latitude", buffer_distance = 50,
raster_layers = vars, mask = TRUE)
raster::plot(b_area1$masked_variables[[1]])
sp::plot(b_area1$calibration_area, add = TRUE)
points(occurrences[, 2:3])
# producing polygons, masking layers, and saving results
b_area2 <- buffer_area(data = occurrences, longitude = "longitude",
latitude = "latitude", buffer_distance = 50,
raster_layers = vars, mask = TRUE, save = TRUE,
name = "buff_area")
# check directory
dir()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.