Description Usage Arguments Value Examples
View source: R/spat_ras_function.R
A function to get the WEGE index value for a provided polygon.
1 2 3 4 5 6 7 8 9 10 11 |
target_area |
Either a sp or sf object to which to calculate the WEGE index. |
input |
Species ranges, either from a shapefile or from a georeferenced species list with a column for species, two columns for coordinates and one for the IUCN category. |
x |
name of the longitude column. |
y |
name of the latitude column. |
species |
name of the species column. |
category |
name of IUCN the category column. Terminology must be as follows: DD for Data Deficient, LC for Least Concern, NT for Near Threatened, EN, for Endangered, CR for Critically Endangered, EW for Extinct in the wild and EX for Extinct. |
show_progress |
Progress of the analysis by showing the number of the grid where the function is calculating the different indices. |
ed |
name of the evolutionary distinctiveness column. |
res |
grid-cell size to use to calculate the range of the species in case a georeferenced species list was provided. |
A RasterStack with rasters for each KBA criteria (A1a,A1b,A1e,B1) and indices calculated (GE,ED,EDGE,WEGE)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(WEGE)
library(sp)
library(sf)
library(raster)
species <- sample(letters, 10)
range_list <- list()
for (i in seq_along(species)) {
temp0 <- cbind(runif(3,1,50),runif(3,1,50))
temp <- Polygon(rbind(temp0,temp0[1,]))
range_list[[i]] <- Polygons(list(temp), ID = c(species[i]))
}
input <- st_as_sf(SpatialPolygons(range_list))
categories <- c('LC','NT','VU','EN','CR')
input$binomial <- species
input$category <- sample(size = nrow(input),x = categories,replace = TRUE)
input$ed <- runif(runif(10,1,50))
temp0 <- cbind(runif(3,1,50),runif(3,1,50))
target_area <- Polygon(rbind(temp0,temp0[1,]))
target_area <- Polygons(list(target_area), ID = 'Target area')
target_area <- st_as_sf(SpatialPolygons(list(target_area)))
spat_ras(target_area,input,species = 'binomial',ed='ed', res = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.