MaxentVariableSelection error reading files, error in file (file, 'rt') cannot open connection

71 views Asked by At

I'm attempting to use the MaxentVariableSelection package to select the best set of environmental variables for a Maxent species distribution model.

I keep getting these two errors:

  • Error: Error reading files

  • Error in file(file, "rt"): cannot open the connection

In addition: Warning messages:

  1. In dir.create(outdir):

    /Users/klairetrhodes/Desktop/Thesis/Output already exists

  2. In file(file, "rt"):

    cannot open file /Users/klairetrhodes/Desktop/Thesis/Output/maxentResults.csv: No such file or directory

I have confirmed the following:

  • all my environmental variables are ASCII files with common extent
  • occurrence and background data is properly formatted
  • file paths are accurate and exist
  • I have run a simple Maxent model using dismo with a small set of variables -- that seemed to work fine
1

There are 1 answers

1
Bananarama On

This error suggests that there's an issue with reading files. It could be due to incorrect file paths or incorrect file formats as you already suggest yourself.

try


    getwd()

to see where your working directory is located.

Create directories if not exist: Before trying to create a directory using dir.create(outdir), you can check if the directory already exists. If it doesn't exist, then create it.


    if (!file.exists(outdir)) {
      dir.create(outdir)
    }