get_wege {WEGE}R Documentation

get_wege

Description

A function to get the WEGE index value for a provided polygon.

Usage

get_wege(
  target_area,
  input,
  x,
  y,
  species = "binomial",
  category = "category",
  res = 1
)

Arguments

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.

res

grid-cell size to use to calculate the range of the species in

case a georeferenced species list was provided.

Value

a value corresponding to the WEGE index value of the provided target_area

Examples

library(sp)
library(sf)
library(WEGE)

species <- letters[1:26]
range_list <- list()
for (i in seq_along(species)){
  temp  <-  Polygon(cbind(runif(4,1,50),runif(4,1,50)))
  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)

target_area <- Polygon(cbind(runif(4,1,50),runif(4,1,50)))
target_area <- Polygons(list(target_area), ID = 'Target area')
target_area <- st_as_sf(SpatialPolygons(list(target_area)))
get_wege(target_area,input,species = 'binomial',category = 'category')

[Package WEGE version 0.1.0 Index]