0

I had already done some niche modeling with maxent() and doing it step by step i don't have any problem. when i try to do it in a loop for more models just give this Error:

Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "data.frame"

For example:

I have a data base like this (this is like a summary)

xm <- maxent(capas, SP1, path=paste("Maxent_",sub(" ","_",as.character(SP$Especie[1])),sep=""))

px = predict(capas, xm, progress='')

That works perfectly but when a do it on a loop like this:

for(i in 1:10) {

MT=maxent(CAPAS,subset(BioSp,BioSp$Sp==Spp[i],select=c(2,3)), path=paste("Modelos/Maxent_",
        sub(" ","_",as.character(Spp[i])),sep=""))

MODEL=predict(CAPAS,MT,progress="windows",filename=paste(model,"asc",sep="."), overwrite=T)
}

Gives this problem:

Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "data.frame"

Early today was working perfectly but now it doesn't work

Please i need help with this, I don't know whats happening with the class of the object. I didn't change anything on this and started to give me problems.

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • 1
    What is `CAPAS` and is that different than `capas` (R is case sensitive). It would be much easier to help you if you provided a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Where does the `maxent` function come from? – MrFlick Mar 21 '17 at 04:11
  • Try specifying `predict(data = CAPAS, object = MT, ...)` or in if CAPAS is not a dataset, then drop it `predict(object = MT)`. – nya Mar 21 '17 at 09:49

0 Answers0