# NOT RUN {
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')
# }
Run the code above in your browser using DataLab