0

hope someone can help me here. I am a ecologist and as part of my master degree's thesis I am making some species distribution using the maxent (https://www.cs.princeton.edu/~schapire/maxent/) function in R, with the Dismo package.

In a certain point of the script (exactilly the one with refers to the model itself) I am using the follow command line:

me<-maxent(predictors,spp.occ,args=c("-J","-P","replicates=10","replicatetype=crossvalidate"),path='Results')

And I get the following error message:

Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'Results/species_9.lambdas': No such file or directory

After redoing the command several times exploring all its arguments I came to the conclusion that the argument that generates the error is the replicates = 10, which means that I want to replicate 10 times the template. I have perfomed with a smaller number of replications and up to 9 there was no error.

In advance I apologize for my language, in fact I am not a programmer, but I really need to resolve this issue and hope someone can help me.

Thank you very much.

The best,

Ramiro.

  • Looks like your operating system, whatever it might be, did not think that `path='Results'` was an appropriate path. You probably need to give a full path which generally would appear having an initial "/" and then other directory and sub-directory names, separated by "/", and perhaps a trailing "/". Read the `?maxent` page carefully. The "replicates=10" does look odd but it does conform to the template in the examples. Appears it is passed to an external program named `MaxEnt` that is given responsibility for parsing it. – IRTFM Mar 30 '17 at 00:44
  • Thanks, the problem is solved! – Ramiro Dário Melinski May 06 '17 at 21:24

1 Answers1

0

Hey just looping back to this because the comment above did not fix this issue for me: When the dismo::maxent function breaks, it will often throw this error instead of actually telling you what's wrong. Navigate to the path folder and find the "MaxEnt.log" file. Open that with notepad and that is the actual error message you're looking for.

The error message here is a bit inane as the ".lambdas" file is a temp file that the function is supposed to create itself. It can't find it because it never makes it because it has quietly broken in a previous step

Michael L
  • 181
  • 1
  • 4