1

I am trying to model a plant species (composed by 298 occurrences) with BIOMOD2 using the consensus landcover as explanatory variables. However, R shows me an error message during the formatting of input data that I do not understand at all:

Error in .local(sp, env, ...) : object 'mask.tmp' not found

I have a feeling that the problem is related to the training area or something similar, because If I run the analysis in other study areas (with the same explanatory variables, but changing the occurrences and the training area), the code works perfectly!

Could someone help me in fixing this error and understanding where it is coming from?

The following code is an example of my used code:

#Loading libraries
library(biomod2)
library(raster)
library(rgdal)

#Loading occurrences
sic.occ.EUR<- as.data.frame(readOGR(dsn = "C:\\Users\\Invader\\Desktop\\minba1", layer = "occ_JAP"))
sic.occ.EUR <- sic.occ.EUR[,c(4,5)]
sic.occ.EUR$Sycios <- 1
names(sic.occ.EUR) <- c("X_WGS84","Y_WGS84","Sycios")

#Loading explanatory variables

Tbio <- raster("C:\\Users\\Invader\\Desktop\\minba1\\ consensus_full_class_4_crop.tif")
Pbio <- raster("C:\\Users\\Invader\\Desktop\\minba1\\ consensus_full_class_7_crop.tif")
myExpl.EUR <- stack(Tbio,Pbio)
myRespName.EUR <- "Sycios"
myExpl.proj.EUR <- stack(Tbio,Pbio)
final.EUR.myResp <- as.numeric(sic.occ.EUR[,myRespName.EUR])
myRespXY.EUR <- sic.occ.EUR[,c("X_WGS84","Y_WGS84")]


#Formating input data
myBioData.EUR <- BIOMOD_FormatingData(resp.var=final.EUR.myResp,
                                       expl.var=myExpl.EUR,
                                       resp.xy=myRespXY.EUR,
                                       resp.name=myRespName.EUR,
                                       PA.nb.rep = 5,
                                       PA.nb.absences = 10000,
                                       PA.strategy ='random',
                                       PA.dist.min = NULL,
                                       PA.dist.max = NULL,
                                       PA.sre.quant = 0.025,
                                       PA.table = NULL,
                                       na.rm = TRUE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.