0

I am working on making a loop in R that creates species distribution models in R for multiple species in a relatively large matrix. In order to avoid analysis redundancy, I would like to have a command at the beginning of the loop to skip the analysis if a file output already exists. Does anyone have any suggestions on how to add this line of code?

demongolem
  • 9,474
  • 36
  • 90
  • 105
I Del Toro
  • 913
  • 4
  • 15
  • 36

1 Answers1

1
if(file.exists(filename)) {
   next
}

at the beginning of the loop? As long as you really wish not only to use a loop in R but also a next in there :)

vodka
  • 498
  • 2
  • 9