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

Question on load_occ #136

Open
RafP2021 opened this issue Oct 13, 2024 · 2 comments
Open

Question on load_occ #136

RafP2021 opened this issue Oct 13, 2024 · 2 comments
Assignees
Labels

Comments

@RafP2021
Copy link

RafP2021 commented Oct 13, 2024

Dears,
I have to signal that SSDM seems unable to operate after updating to the latest version of R.

The problem might be due to something that clashes with how the function load_occ() internally works.

Here below I post what I get, no matter how I try to set up the .csv file containing the occurrences:

> load_occ(Env = Env, file = "occu.csv", Xcol = "Longitude", Ycol = "Latitude", Spcol = "species")
Occurrences loading 
Error in xtfrm.data.frame(x) : not possible xtfrm the data frame

Please note that the above written "occu.csv" is the saved "Occurrences" object provided by default in SSDM, so it must be forcefully complying with the csv setting requirements (which however are very flexible).

Unfortunately I am not able to fully understand the point where the native code of load_occ() recalls xtfrm and crashes. I notice that it uses read.csv2() to upload the file, but then I have not enough knowledge of R to spot where and how it handles it as a dataframe.

Thank you for any suggestions you may have in addressing this issue.

@sylvainschmitt
Copy link
Owner

Dear @RafP2021 ,

Please:

  • Use reproducible examples for bugs. In your case I just run the example from load_occ using ?load_occ under R 4.4.1 and it worked perfectly
  • Use appropriate title for issues a bit more precociously, because in this case you re a bit over alerting when you have a local issue
  • Check the way you saved the csv file in your case because I suspect the error came from their

Sylvain

@sylvainschmitt sylvainschmitt changed the title SSDM no longer works under R. 4. 4. 1 Bugs using load_occ Oct 14, 2024
@sylvainschmitt sylvainschmitt self-assigned this Oct 14, 2024
@sylvainschmitt sylvainschmitt changed the title Bugs using load_occ Quesiton using load_occ Oct 14, 2024
@sylvainschmitt sylvainschmitt changed the title Quesiton using load_occ Question on load_occ Oct 14, 2024
@RafP2021
Copy link
Author

Dear Sylvain,
Thank you very much for your answer, and please excuse me for the excessively alarming title. In the end, I was able to understand the issue: the specification of the separator is basically mandatory, simply because the function uses read.csv2() to load the csv file so it made an assumption (sep = ; ) that was not in line with the format of my .csv list. Here's the fixed script:

Occurrences <- load_occ( path = "C:/Desktop/SSDM/Models_for_species1/workdir/", Env = Env, file = "species1_occurrences.csv", sep = ",", Xcol = "X", Ycol = "Y", Spcol = "species", GeoRes = TRUE, reso = max(res(Env@layers[[1]])), verbose = TRUE, GUI = FALSE )

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

No branches or pull requests

2 participants