Open rbfontana opened 1 year ago
Hi @rbfontana, could you try updating the package from Github. Also, try the updated code: http://brunovilela.github.io/letsR/articles/A-guide-to-transform-species-distributions-into-a-presence-absence-matrix-based.html From your error, your polygon seems to have a problem. But maybe it will work on the new version which was highly modified.
Hi developers,
I'm trying to create a presence-absence matrix, but I'm having a problem. When I run my analysis the following error occurs, I've tried to fix it, but I can't.
CODE
Load packages library(maptools) library(raster) library(letsR) library(rgdal)
Import shapefiles # All shp are SpatialPolygonsDataFrame class biomes<-readOGR("biomes_05.shp") # Biomes from New World according Olson. Shp with 27844 elements anurans<-readShapePoly("anurans.shp") # Shapefile of anurans from New World extracted from IUCN data with 3710 elements
Select by names anurans@data[["binomial"]]<-anurans@data[["sci_name"]]
Add projection to the anurans shp projection(anurans) <- projection(biomes)
Create PA matrix for biomes biomes_abspres<-lets.presab.grid(shapes = anurans, grid = biomes, sample.unit = "id")