Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in y[i, ] : cannot get a slot ("Polygons") from an object of type "NULL" #12

Open
Marialejandra opened this issue Mar 16, 2023 · 4 comments

Comments

@Marialejandra
Copy link

Hola Bruno y Fabricio! I am getting this error when I try to run lets.presab:

Error in y[i, ] : cannot get a slot ("Polygons") from an object of type "NULL"

This is what I am trying to run:

Import the shapefile data

helio <- readShapePoly("data_0.shp", delete_null_obj = TRUE)

Transform anuran polygons into a global PAM

pam_helio <- lets.presab(helio, resol = 1)

Call the object

pam_helio

Summary of the PAM

summary(pam_helio)

The file data_0.shp is a shape file that I downloaded from IUCN (Range data Polygons SHP).

Can you help with this? Thank you :)

@fabro
Copy link
Contributor

fabro commented Mar 16, 2023

Hi Marialejandra,

Thanks for the interest in our package. It seems that the polygons were not properly read/loaded. Could you share that file so we can check and try to reproduce the error?

@Marialejandra
Copy link
Author

Hola Fabricio! Thank you for answering so quickly! I am enjoying your package; pretty cool. Here is the file that I used.
Fabricio, I have a question. I created shapes of the geographical distribution of the taxa that I am currently studying. Can I use those shapefiles instead of the IUCN files? Thank you.
redlist_species_data_bea7543e-1bdc-4501-8ec3-5dd3cdaf4b01 (1).zip

@fabro
Copy link
Contributor

fabro commented Mar 16, 2023

Gracias, Marialejandra.

The error has to do with the column name of the species. As explained in the help: "Species names should be in a column (within the .DBF table of the shapefile) called BINOMIAL/binomial or SCINAME/sciname." In your case, this was "SCI_NAME", hence the error.

Yes, you can use any other shapefiles. As long as you keep the same structure (a shapefile with all polygons/species of interest) and have that column name (BINOMIAL/binomial or SCINAME/sciname).

@Marialejandra
Copy link
Author

Gracias Fabricio!
I edited the DBF file and changed the name of the column. However, I am having a different error:
Error in getinfo.shape(filen) : Error opening SHP file. I tried with Anura (the taxa in the script) and I am getting the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants