# NOT RUN {
require(sp)
x <- data.frame(species = c("A", "B"),
decimallongitude = runif(100, -170, 170),
decimallatitude = runif(100, -80,80))
range_species_A <- Polygon(cbind(c(-45,-45,-60,-60,-45),c(-10,-25,-25,-10,-10)))
range_species_B <- Polygon(cbind(c(15,15,32,32,15),c(10,-10,-10,10,10)))
range_A <- Polygons(list(range_species_A), ID = c("A"))
range_B <- Polygons(list(range_species_B), ID = c("B"))
range <- SpatialPolygons(list(range_A, range_B))
df <- data.frame(species = c("A", "B"), row.names = c("A", "B"))
range <- SpatialPolygonsDataFrame(range, data = as.data.frame(df))
cc_iucn(x = x, range = range, buffer = 10)
# }
Run the code above in your browser using DataLab