babaknaimi / sdm

sdm is an extensible framework to develop species distributions models using individual and community-based approaches, generate ensembles of models, evaluate the models, and predict species potential distributions in space and time.
21 stars 5 forks source link

Error in predict() #16

Closed julia-schiller closed 2 years ago

julia-schiller commented 2 years ago

Hi there,

when running p<-raster::predict(x=m1,newdata=preds, filename='prediction1.img', mean=TRUE)

I receive the following ERROR: Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "sdmModels"

The same with ensemble: ens <-ensemble(data=m1,newdata =preds,filename='ens1.grd',setting=list(method='weighted',stat='TSS',opt=2)) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘ensemble’ for signature ‘"missing", "RasterStack"’

I pedantically followed the vignette and youtube tutorials by Biogeoinformatics, and yes, all libraries were installed.

So, any idea what might be going on here? Thanks for any help!

babaknaimi commented 2 years ago

You put the wrong argument names in the ensemble function. The correct one is as follows:

ens <-ensemble(m1,newdata =preds,filename='ens1.grd',setting=list(method='weighted',stat='TSS',opt=2))